#line 1 "numpy/core/src/multiarray/lowlevel_strided_loops.c.src"

/*
 *****************************************************************************
 **       This file was autogenerated from a template  DO NOT EDIT!!!!      **
 **       Changes should be made to the original source (.src) file         **
 *****************************************************************************
 */

#line 1
/*
 * This file contains low-level loops for copying and byte-swapping
 * strided data.
 *
 * Copyright (c) 2010 by Mark Wiebe (mwwiebe@gmail.com)
 * The University of British Columbia
 *
 * See LICENSE.txt for the license.
 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/arrayobject.h>
#include <numpy/npy_cpu.h>
#include <numpy/halffloat.h>

#include "lowlevel_strided_loops.h"
#include "array_assign.h"
#include "array_method.h"
#include "usertypes.h"


/*
 * x86 platform works with unaligned access but the compiler is allowed to
 * assume all data is aligned to its size by the C standard. This means it can
 * vectorize instructions peeling only by the size of the type, if the data is
 * not aligned to this size one ends up with data not correctly aligned for SSE
 * instructions (16 byte).
 * So this flag can only be enabled if autovectorization is disabled.
 */
#if NPY_ALIGNMENT_REQUIRED
#  define NPY_USE_UNALIGNED_ACCESS 0
#else
#  define NPY_USE_UNALIGNED_ACCESS 0
#endif

#define _NPY_NOP1(x) (x)
#define _NPY_NOP2(x) (x)
#define _NPY_NOP4(x) (x)
#define _NPY_NOP8(x) (x)

#define _NPY_SWAP2(x) npy_bswap2(x)

#define _NPY_SWAP4(x) npy_bswap4(x)

#define _NPY_SWAP_PAIR4(x) (((((npy_uint32)x)&0xffu) << 8) | \
                       ((((npy_uint32)x)&0xff00u) >> 8) | \
                       ((((npy_uint32)x)&0xff0000u) << 8) | \
                       ((((npy_uint32)x)&0xff000000u) >> 8))

#define _NPY_SWAP8(x) npy_bswap8(x)

#define _NPY_SWAP_PAIR8(x) (((((npy_uint64)x)&0xffULL) << 24) | \
                       ((((npy_uint64)x)&0xff00ULL) << 8) | \
                       ((((npy_uint64)x)&0xff0000ULL) >> 8) | \
                       ((((npy_uint64)x)&0xff000000ULL) >> 24) | \
                       ((((npy_uint64)x)&0xff00000000ULL) << 24) | \
                       ((((npy_uint64)x)&0xff0000000000ULL) << 8) | \
                       ((((npy_uint64)x)&0xff000000000000ULL) >> 8) | \
                       ((((npy_uint64)x)&0xff00000000000000ULL) >> 24))

#define _NPY_SWAP_INPLACE2(x) npy_bswap2_unaligned(x)

#define _NPY_SWAP_INPLACE4(x) npy_bswap4_unaligned(x)

#define _NPY_SWAP_INPLACE8(x) npy_bswap8_unaligned(x)

#define _NPY_SWAP_INPLACE16(x) { \
        char a = (x)[0]; (x)[0] = (x)[15]; (x)[15] = a; \
        a = (x)[1]; (x)[1] = (x)[14]; (x)[14] = a; \
        a = (x)[2]; (x)[2] = (x)[13]; (x)[13] = a; \
        a = (x)[3]; (x)[3] = (x)[12]; (x)[12] = a; \
        a = (x)[4]; (x)[4] = (x)[11]; (x)[11] = a; \
        a = (x)[5]; (x)[5] = (x)[10]; (x)[10] = a; \
        a = (x)[6]; (x)[6] = (x)[9]; (x)[9] = a; \
        a = (x)[7]; (x)[7] = (x)[8]; (x)[8] = a; \
        }

/************* STRIDED COPYING/SWAPPING SPECIALIZED FUNCTIONS *************/

#line 89
#line 95
#line 103

#if (1 >= 1) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _strided_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 1) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_strided_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_strided_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_strided_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP1(dst);
#  elif 1 == 2
        _NPY_SWAP0(dst);
        _NPY_SWAP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_pair_strided_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 4 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_PAIR1(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR0(dst);
        _NPY_SWAP_PAIR0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 4 */



#line 95
#line 103

#if (1 >= 1) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _strided_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 1) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_strided_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_strided_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_strided_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP1(dst);
#  elif 1 == 2
        _NPY_SWAP0(dst);
        _NPY_SWAP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_pair_strided_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 1 >= 4 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_PAIR1(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR0(dst);
        _NPY_SWAP_PAIR0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 0
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 1 >= 4 */



#line 95
#line 103

#if (1 >= 1) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _contig_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 1) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_contig_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_contig_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_contig_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP1(dst);
#  elif 1 == 2
        _NPY_SWAP0(dst);
        _NPY_SWAP0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_pair_contig_to_strided_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 4 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_strided_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_strided_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_PAIR1(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR0(dst);
        _NPY_SWAP_PAIR0(dst + 0);
#  endif

#endif

#if 0
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_strided_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 0)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 0
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 4 */



#line 95
#line 103

#if (1 >= 1) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _contig_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 1) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_contig_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 0 == 1
        _NPY_NOP1(dst);
#  elif 0 == 2
        _NPY_NOP0(dst);
        _NPY_NOP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_NOP1(*((npy_uint8 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 1 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_contig_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 2) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_contig_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 1 == 1
        _NPY_SWAP1(dst);
#  elif 1 == 2
        _NPY_SWAP0(dst);
        _NPY_SWAP0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP1(*((npy_uint8 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 2 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _swap_pair_contig_to_contig_size1\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_INPLACE1(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE0(dst);
        _NPY_SWAP_INPLACE0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_INPLACE1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 1 >= 4 */


#line 103

#if (1 >= 4) && \
    (1 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 1 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_contig_size1(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_contig_size1\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 1 != 16
        (*((npy_uint8 *)dst)) = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 1);
#  if 2 == 1
        _NPY_SWAP_PAIR1(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR0(dst);
        _NPY_SWAP_PAIR0(dst + 0);
#  endif

#endif

#if 1
        dst += 1;
#else
        dst += dst_stride;
#endif

#if 1
        src += 1;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_contig_size1_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1 != 16
#  if !(1 == 1 && 1)
    npy_uint8 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 1 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint8)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint8)));
#endif
#if 1 == 1 && 1
    memset(dst, *src, N);
#else

#  if 1 != 16
    temp = _NPY_SWAP_PAIR1(*((npy_uint8 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 1 != 16
        *((npy_uint8 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 1;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 1 >= 4 */




#line 89
#line 95
#line 103

#if (2 >= 1) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _strided_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 1) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_strided_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_strided_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_strided_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP2(dst);
#  elif 1 == 2
        _NPY_SWAP1(dst);
        _NPY_SWAP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_pair_strided_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 4 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_PAIR2(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR1(dst);
        _NPY_SWAP_PAIR1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 4 */



#line 95
#line 103

#if (2 >= 1) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _strided_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 1) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_strided_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_strided_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_strided_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP2(dst);
#  elif 1 == 2
        _NPY_SWAP1(dst);
        _NPY_SWAP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_pair_strided_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 2 >= 4 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_PAIR2(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR1(dst);
        _NPY_SWAP_PAIR1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 0
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 2 >= 4 */



#line 95
#line 103

#if (2 >= 1) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _contig_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 1) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_contig_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_contig_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_contig_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP2(dst);
#  elif 1 == 2
        _NPY_SWAP1(dst);
        _NPY_SWAP1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_pair_contig_to_strided_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 4 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_strided_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_strided_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_PAIR2(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR1(dst);
        _NPY_SWAP_PAIR1(dst + 1);
#  endif

#endif

#if 0
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_strided_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 0)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 0
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 4 */



#line 95
#line 103

#if (2 >= 1) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _contig_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 1) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_contig_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 0 == 1
        _NPY_NOP2(dst);
#  elif 0 == 2
        _NPY_NOP1(dst);
        _NPY_NOP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_NOP2(*((npy_uint16 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 1 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_contig_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 2) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_contig_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 1 == 1
        _NPY_SWAP2(dst);
#  elif 1 == 2
        _NPY_SWAP1(dst);
        _NPY_SWAP1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP2(*((npy_uint16 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 2 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _swap_pair_contig_to_contig_size2\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_INPLACE2(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE1(dst);
        _NPY_SWAP_INPLACE1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_INPLACE2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 2 >= 4 */


#line 103

#if (2 >= 4) && \
    (2 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 2 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_contig_size2(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_contig_size2\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 2 != 16
        (*((npy_uint16 *)dst)) = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 2);
#  if 2 == 1
        _NPY_SWAP_PAIR2(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR1(dst);
        _NPY_SWAP_PAIR1(dst + 1);
#  endif

#endif

#if 1
        dst += 2;
#else
        dst += dst_stride;
#endif

#if 1
        src += 2;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_contig_size2_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 2 != 16
#  if !(2 == 1 && 1)
    npy_uint16 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 2 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint16)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint16)));
#endif
#if 2 == 1 && 1
    memset(dst, *src, N);
#else

#  if 2 != 16
    temp = _NPY_SWAP_PAIR2(*((npy_uint16 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 2 != 16
        *((npy_uint16 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 2;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 2 >= 4 */




#line 89
#line 95
#line 103

#if (4 >= 1) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _strided_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 1) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_strided_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_strided_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_strided_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP4(dst);
#  elif 1 == 2
        _NPY_SWAP2(dst);
        _NPY_SWAP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_pair_strided_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 4 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_PAIR4(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR2(dst);
        _NPY_SWAP_PAIR2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 4 */



#line 95
#line 103

#if (4 >= 1) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _strided_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 1) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_strided_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_strided_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_strided_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP4(dst);
#  elif 1 == 2
        _NPY_SWAP2(dst);
        _NPY_SWAP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_pair_strided_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 4 >= 4 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_PAIR4(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR2(dst);
        _NPY_SWAP_PAIR2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 0
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 4 >= 4 */



#line 95
#line 103

#if (4 >= 1) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _contig_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 1) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_contig_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_contig_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_contig_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP4(dst);
#  elif 1 == 2
        _NPY_SWAP2(dst);
        _NPY_SWAP2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_pair_contig_to_strided_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 4 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_strided_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_strided_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_PAIR4(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR2(dst);
        _NPY_SWAP_PAIR2(dst + 2);
#  endif

#endif

#if 0
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_strided_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 0)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 0
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 4 */



#line 95
#line 103

#if (4 >= 1) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _contig_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 1) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_contig_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 0 == 1
        _NPY_NOP4(dst);
#  elif 0 == 2
        _NPY_NOP2(dst);
        _NPY_NOP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_NOP4(*((npy_uint32 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 1 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_contig_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 2) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_contig_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 1 == 1
        _NPY_SWAP4(dst);
#  elif 1 == 2
        _NPY_SWAP2(dst);
        _NPY_SWAP2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP4(*((npy_uint32 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 2 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _swap_pair_contig_to_contig_size4\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_INPLACE4(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE2(dst);
        _NPY_SWAP_INPLACE2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_INPLACE4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 4 >= 4 */


#line 103

#if (4 >= 4) && \
    (4 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 4 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_contig_size4(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_contig_size4\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 4 != 16
        (*((npy_uint32 *)dst)) = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 4);
#  if 2 == 1
        _NPY_SWAP_PAIR4(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR2(dst);
        _NPY_SWAP_PAIR2(dst + 2);
#  endif

#endif

#if 1
        dst += 4;
#else
        dst += dst_stride;
#endif

#if 1
        src += 4;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_contig_size4_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 4 != 16
#  if !(4 == 1 && 1)
    npy_uint32 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 4 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint32)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint32)));
#endif
#if 4 == 1 && 1
    memset(dst, *src, N);
#else

#  if 4 != 16
    temp = _NPY_SWAP_PAIR4(*((npy_uint32 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 4 != 16
        *((npy_uint32 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 4;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 4 >= 4 */




#line 89
#line 95
#line 103

#if (8 >= 1) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _strided_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 1) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_strided_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_strided_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_strided_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP8(dst);
#  elif 1 == 2
        _NPY_SWAP4(dst);
        _NPY_SWAP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_strided_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 4 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_PAIR8(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR4(dst);
        _NPY_SWAP_PAIR4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 4 */



#line 95
#line 103

#if (8 >= 1) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _strided_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 1) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_strided_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_strided_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_strided_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP8(dst);
#  elif 1 == 2
        _NPY_SWAP4(dst);
        _NPY_SWAP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_strided_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 8 >= 4 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_PAIR8(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR4(dst);
        _NPY_SWAP_PAIR4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 0
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 8 >= 4 */



#line 95
#line 103

#if (8 >= 1) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _contig_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 1) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_contig_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_contig_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_contig_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP8(dst);
#  elif 1 == 2
        _NPY_SWAP4(dst);
        _NPY_SWAP4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_contig_to_strided_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 4 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_strided_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_strided_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_PAIR8(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR4(dst);
        _NPY_SWAP_PAIR4(dst + 4);
#  endif

#endif

#if 0
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_strided_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 0
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 4 */



#line 95
#line 103

#if (8 >= 1) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _contig_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 1) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_contig_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 0 == 1
        _NPY_NOP8(dst);
#  elif 0 == 2
        _NPY_NOP4(dst);
        _NPY_NOP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_NOP8(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 1 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_contig_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 2) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_contig_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 1 == 1
        _NPY_SWAP8(dst);
#  elif 1 == 2
        _NPY_SWAP4(dst);
        _NPY_SWAP4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP8(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 2 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_contig_to_contig_size8\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_INPLACE8(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE4(dst);
        _NPY_SWAP_INPLACE4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_INPLACE8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 8 >= 4 */


#line 103

#if (8 >= 4) && \
    (8 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 8 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_contig_size8(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_contig_size8\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 8 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 8);
#  if 2 == 1
        _NPY_SWAP_PAIR8(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR4(dst);
        _NPY_SWAP_PAIR4(dst + 4);
#  endif

#endif

#if 1
        dst += 8;
#else
        dst += dst_stride;
#endif

#if 1
        src += 8;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_contig_size8_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 8 != 16
#  if !(8 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 8 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 8 == 1 && 1
    memset(dst, *src, N);
#else

#  if 8 != 16
    temp = _NPY_SWAP_PAIR8(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 8 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 8;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 8 >= 4 */




#line 89
#line 95
#line 103

#if (16 >= 1) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _strided_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 1) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_strided_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_strided_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_strided_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP16(dst);
#  elif 1 == 2
        _NPY_SWAP8(dst);
        _NPY_SWAP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_strided_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 4 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_PAIR16(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR8(dst);
        _NPY_SWAP_PAIR8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 4 */



#line 95
#line 103

#if (16 >= 1) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _strided_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 1) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_strided_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_strided_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_strided_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP16(dst);
#  elif 1 == 2
        _NPY_SWAP8(dst);
        _NPY_SWAP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_strided_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 0 */

#endif/* 16 >= 4 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 0 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_strided_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_strided_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_PAIR16(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR8(dst);
        _NPY_SWAP_PAIR8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 0
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (0 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_strided_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (0 == 0) && 1 */

#endif/* 16 >= 4 */



#line 95
#line 103

#if (16 >= 1) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _contig_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 1) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_contig_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_contig_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_contig_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP16(dst);
#  elif 1 == 2
        _NPY_SWAP8(dst);
        _NPY_SWAP8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_contig_to_strided_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 4 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 0 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_strided_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_strided_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_PAIR16(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR8(dst);
        _NPY_SWAP_PAIR8(dst + 8);
#  endif

#endif

#if 0
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_strided_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 0)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 0
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 0
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 0 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 4 */



#line 95
#line 103

#if (16 >= 1) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _contig_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 1) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 0 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 0 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_contig_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 0 == 1
        _NPY_NOP16(dst);
#  elif 0 == 2
        _NPY_NOP8(dst);
        _NPY_NOP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_NOP16(*((npy_uint64 *)src));
#  else
#    if 0 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 0 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 0 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 1 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_contig_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 1 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 2) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 1 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 1 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_contig_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 1 == 1
        _NPY_SWAP16(dst);
#  elif 1 == 2
        _NPY_SWAP8(dst);
        _NPY_SWAP8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP16(*((npy_uint64 *)src));
#  else
#    if 1 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 1 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 1 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 2 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 0) && \
    (!NPY_USE_UNALIGNED_ACCESS || 0)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 0 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_swap_pair_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 0
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _swap_pair_contig_to_contig_size16\n");*/
    while (N > 0) {
#if 0

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_INPLACE16(dst);
#  elif 2 == 2
        _NPY_SWAP_INPLACE8(dst);
        _NPY_SWAP_INPLACE8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 0
static NPY_GCC_OPT_3 int
_swap_pair_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 0 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_INPLACE16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 0 */

#endif/* 16 >= 4 */


#line 103

#if (16 >= 4) && \
    (16 > 1 || 1) && \
    (!NPY_USE_UNALIGNED_ACCESS || 1)


#if 2 || 1 == 0 || 1 == 0
/*
 * unrolling gains about 20-50% if the copy can be done in one mov instruction
 * if not it can decrease performance
 * tested to improve performance on intel xeon 5x/7x, core2duo, amd phenom x4
 */
static int
#if 1 && 2 == 0 && 16 <= NPY_SIZEOF_INTP
    NPY_GCC_UNROLL_LOOPS
#endif
_aligned_swap_pair_contig_to_contig_size16(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0];
#endif
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 1
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
    /*printf("fn _aligned_swap_pair_contig_to_contig_size16\n");*/
    while (N > 0) {
#if 1

        /* aligned copy and swap */
#  if 16 != 16
        (*((npy_uint64 *)dst)) = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        (*((npy_uint64 *)dst)) = (*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        (*((npy_uint64 *)dst)) = _NPY_SWAP8(*((npy_uint64 *)src));
        (*((npy_uint64 *)dst + 1)) = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

#else

        /* unaligned copy and swap */
        memmove(dst, src, 16);
#  if 2 == 1
        _NPY_SWAP_PAIR16(dst);
#  elif 2 == 2
        _NPY_SWAP_PAIR8(dst);
        _NPY_SWAP_PAIR8(dst + 8);
#  endif

#endif

#if 1
        dst += 16;
#else
        dst += dst_stride;
#endif

#if 1
        src += 16;
#else
        src += src_stride;
#endif

        --N;
    }
    return 0;
}
#endif


/*
 * specialized copy and swap for source stride 0,
 * interestingly unrolling here is like above is only marginally profitable for
 * small types and detrimental for >= 8byte moves on x86
 * but it profits from vectorization enabled with -O3
 */
#if (1 == 0) && 1
static NPY_GCC_OPT_3 int
_aligned_swap_pair_contig_to_contig_size16_srcstride0(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(auxdata))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp dst_stride = strides[1];
#endif

#if 16 != 16
#  if !(16 == 1 && 1)
    npy_uint64 temp;
#  endif
#else
    npy_uint64 temp0, temp1;
#endif
    if (N == 0) {
        return 0;
    }
#if 1 && 16 != 16
    /* sanity check */
    assert(N == 0 || npy_is_aligned(dst, _UINT_ALIGN(npy_uint64)));
    assert(N == 0 || npy_is_aligned(src, _UINT_ALIGN(npy_uint64)));
#endif
#if 16 == 1 && 1
    memset(dst, *src, N);
#else

#  if 16 != 16
    temp = _NPY_SWAP_PAIR16(*((npy_uint64 *)src));
#  else
#    if 2 == 0
        temp0 = (*((npy_uint64 *)src));
        temp1 = (*((npy_uint64 *)src + 1));
#    elif 2 == 1
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src));
#    elif 2 == 2
        temp0 = _NPY_SWAP8(*((npy_uint64 *)src));
        temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1));
#    endif
#  endif

    while (N > 0) {
#  if 16 != 16
        *((npy_uint64 *)dst) = temp;
#  else
        *((npy_uint64 *)dst) = temp0;
        *((npy_uint64 *)dst + 1) = temp1;
#  endif
#  if 1
        dst += 16;
#  else
        dst += dst_stride;
#  endif
        --N;
    }
#endif/* @elsize == 1 && 1 -- else */
    return 0;
}
#endif/* (1 == 0) && 1 */

#endif/* 16 >= 4 */





static int
_strided_to_strided(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
    npy_intp src_stride = strides[0], dst_stride = strides[1];
    npy_intp src_itemsize = context->descriptors[0]->elsize;

    while (N > 0) {
        memmove(dst, src, src_itemsize);
        dst += dst_stride;
        src += src_stride;
        --N;
    }
    return 0;
}

/*
 * NOTE: This function is currently unused. It would currently be used for
 *       builtin dtypes that have an elsize other than 2, 4, 8, or 16 bytes.
 *       Since unicode and complex swap differently, no such dtype exists.
 */
static int
_swap_strided_to_strided(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
    npy_intp src_stride = strides[0], dst_stride = strides[1];
    npy_intp src_itemsize = context->descriptors[0]->elsize;

    char *a, *b, c;

    while (N > 0) {
        memmove(dst, src, src_itemsize);
        /* general in-place swap */
        a = dst;
        b = dst + src_itemsize - 1;
        while (a < b) {
            c = *a;
            *a = *b;
            *b = c;
            ++a; --b;
        }
        dst += dst_stride;
        src += src_stride;
        --N;
    }
    return 0;
}

static int
_swap_pair_strided_to_strided(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
    npy_intp src_stride = strides[0], dst_stride = strides[1];
    npy_intp src_itemsize = context->descriptors[0]->elsize;

    char *a, *b, c;
    npy_intp itemsize_half = src_itemsize / 2;

    while (N > 0) {
        memmove(dst, src, src_itemsize);
        /* general in-place swap */
        a = dst;
        b = dst + itemsize_half - 1;
        while (a < b) {
            c = *a;
            *a = *b;
            *b = c;
            ++a; --b;
        }
        /* general in-place swap */
        a = dst + itemsize_half;
        b = dst + 2*itemsize_half - 1;
        while (a < b) {
            c = *a;
            *a = *b;
            *b = c;
            ++a; --b;
        }
        dst += dst_stride;
        src += src_stride;
        --N;
    }
    return 0;
}

static int
_contig_to_contig(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *NPY_UNUSED(strides),
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
    npy_intp src_itemsize = context->descriptors[0]->elsize;

    memmove(dst, src, src_itemsize*N);
    return 0;
}


NPY_NO_EXPORT PyArrayMethod_StridedLoop *
PyArray_GetStridedCopyFn(int aligned, npy_intp src_stride,
                         npy_intp dst_stride, npy_intp itemsize)
{
/*
 * Skip the "unaligned" versions on CPUs which support unaligned
 * memory accesses.
 */
#if !NPY_USE_UNALIGNED_ACCESS
    if (aligned) {
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

        /* contiguous dst */
        if (itemsize != 0 && dst_stride == itemsize) {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 400
                    case 1:
                        return
                          &_aligned_strided_to_contig_size1_srcstride0;

#line 400
                    case 2:
                        return
                          &_aligned_strided_to_contig_size2_srcstride0;

#line 400
                    case 4:
                        return
                          &_aligned_strided_to_contig_size4_srcstride0;

#line 400
                    case 8:
                        return
                          &_aligned_strided_to_contig_size8_srcstride0;

#line 400
                    case 16:
                        return
                          &_aligned_strided_to_contig_size16_srcstride0;

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                return &_contig_to_contig;
            }
            /* general src */
            else {
                switch (itemsize) {
#line 416
                    case 1:
                        return &_aligned_strided_to_contig_size1;

#line 416
                    case 2:
                        return &_aligned_strided_to_contig_size2;

#line 416
                    case 4:
                        return &_aligned_strided_to_contig_size4;

#line 416
                    case 8:
                        return &_aligned_strided_to_contig_size8;

#line 416
                    case 16:
                        return &_aligned_strided_to_contig_size16;

                }
            }

            return &_strided_to_strided;
        }
        /* general dst */
        else {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 432
                    case 1:
                        return
                          &_aligned_strided_to_strided_size1_srcstride0;

#line 432
                    case 2:
                        return
                          &_aligned_strided_to_strided_size2_srcstride0;

#line 432
                    case 4:
                        return
                          &_aligned_strided_to_strided_size4_srcstride0;

#line 432
                    case 8:
                        return
                          &_aligned_strided_to_strided_size8_srcstride0;

#line 432
                    case 16:
                        return
                          &_aligned_strided_to_strided_size16_srcstride0;

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                switch (itemsize) {
#line 444
                    case 1:
                        return &_aligned_contig_to_strided_size1;

#line 444
                    case 2:
                        return &_aligned_contig_to_strided_size2;

#line 444
                    case 4:
                        return &_aligned_contig_to_strided_size4;

#line 444
                    case 8:
                        return &_aligned_contig_to_strided_size8;

#line 444
                    case 16:
                        return &_aligned_contig_to_strided_size16;

                }

                return &_strided_to_strided;
            }
            else {
                switch (itemsize) {
#line 456
                    case 1:
                        return &_aligned_strided_to_strided_size1;

#line 456
                    case 2:
                        return &_aligned_strided_to_strided_size2;

#line 456
                    case 4:
                        return &_aligned_strided_to_strided_size4;

#line 456
                    case 8:
                        return &_aligned_strided_to_strided_size8;

#line 456
                    case 16:
                        return &_aligned_strided_to_strided_size16;

                }
            }
        }

#if !NPY_USE_UNALIGNED_ACCESS
    }
    else {
        if (itemsize != 0) {
            if (dst_stride == itemsize) {
                /* contiguous dst */
                if (src_stride == itemsize) {
                    /* contiguous src, dst */
                    return &_contig_to_contig;
                }
                else {
                    /* general src */
                    switch (itemsize) {
                        case 1:
                            return &_aligned_strided_to_contig_size1;
#line 481
                        case 2:
                            return &_strided_to_contig_size2;

#line 481
                        case 4:
                            return &_strided_to_contig_size4;

#line 481
                        case 8:
                            return &_strided_to_contig_size8;

#line 481
                        case 16:
                            return &_strided_to_contig_size16;

                    }
                }

                return &_strided_to_strided;
            }
            else if (src_stride == itemsize) {
                /* contiguous src, general dst */
                switch (itemsize) {
                    case 1:
                        return &_aligned_contig_to_strided_size1;
#line 497
                    case 2:
                        return &_contig_to_strided_size2;

#line 497
                    case 4:
                        return &_contig_to_strided_size4;

#line 497
                    case 8:
                        return &_contig_to_strided_size8;

#line 497
                    case 16:
                        return &_contig_to_strided_size16;

                }

                return &_strided_to_strided;
            }
        }
        else {
            /* general src, dst */
            switch (itemsize) {
                case 1:
                    return &_aligned_strided_to_strided_size1;
#line 513
                case 2:
                    return &_strided_to_strided_size2;

#line 513
                case 4:
                    return &_strided_to_strided_size4;

#line 513
                case 8:
                    return &_strided_to_strided_size8;

#line 513
                case 16:
                    return &_strided_to_strided_size16;

            }
        }
    }
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

    return &_strided_to_strided;
}

/*
 * PyArray_GetStridedCopySwapFn and PyArray_GetStridedCopySwapPairFn are
 * nearly identical, so can do a repeat for them.
 */
#line 533

NPY_NO_EXPORT PyArrayMethod_StridedLoop *
PyArray_GetStridedCopySwapFn(int aligned, npy_intp src_stride,
                             npy_intp dst_stride, npy_intp itemsize)
{
/*
 * Skip the "unaligned" versions on CPUs which support unaligned
 * memory accesses.
 */
#if !NPY_USE_UNALIGNED_ACCESS
    if (aligned) {
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

        /* contiguous dst */
        if (itemsize != 0 && dst_stride == itemsize) {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 554
#if 1 || 2 > 2
                case 2:
                    return
                 &_aligned_swap_strided_to_contig_size2_srcstride0;
#endif

#line 554
#if 1 || 4 > 2
                case 4:
                    return
                 &_aligned_swap_strided_to_contig_size4_srcstride0;
#endif

#line 554
#if 1 || 8 > 2
                case 8:
                    return
                 &_aligned_swap_strided_to_contig_size8_srcstride0;
#endif

#line 554
#if 1 || 16 > 2
                case 16:
                    return
                 &_aligned_swap_strided_to_contig_size16_srcstride0;
#endif

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                switch (itemsize) {
#line 568
#if 1 || 2 > 2
                case 2:
                    return &_aligned_swap_contig_to_contig_size2;
#endif

#line 568
#if 1 || 4 > 2
                case 4:
                    return &_aligned_swap_contig_to_contig_size4;
#endif

#line 568
#if 1 || 8 > 2
                case 8:
                    return &_aligned_swap_contig_to_contig_size8;
#endif

#line 568
#if 1 || 16 > 2
                case 16:
                    return &_aligned_swap_contig_to_contig_size16;
#endif

                }
            }
            /* general src */
            else {
                switch (itemsize) {
#line 581
#if 1 || 2 > 2
                case 2:
                    return &_aligned_swap_strided_to_contig_size2;
#endif

#line 581
#if 1 || 4 > 2
                case 4:
                    return &_aligned_swap_strided_to_contig_size4;
#endif

#line 581
#if 1 || 8 > 2
                case 8:
                    return &_aligned_swap_strided_to_contig_size8;
#endif

#line 581
#if 1 || 16 > 2
                case 16:
                    return &_aligned_swap_strided_to_contig_size16;
#endif

                }
            }
        }
        /* general dst */
        else {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 597
#if 1 || 2 > 2
                case 2:
                    return
                &_aligned_swap_strided_to_strided_size2_srcstride0;
#endif

#line 597
#if 1 || 4 > 2
                case 4:
                    return
                &_aligned_swap_strided_to_strided_size4_srcstride0;
#endif

#line 597
#if 1 || 8 > 2
                case 8:
                    return
                &_aligned_swap_strided_to_strided_size8_srcstride0;
#endif

#line 597
#if 1 || 16 > 2
                case 16:
                    return
                &_aligned_swap_strided_to_strided_size16_srcstride0;
#endif

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                switch (itemsize) {
#line 611
#if 1 || 2 > 2
                case 2:
                    return &_aligned_swap_contig_to_strided_size2;
#endif

#line 611
#if 1 || 4 > 2
                case 4:
                    return &_aligned_swap_contig_to_strided_size4;
#endif

#line 611
#if 1 || 8 > 2
                case 8:
                    return &_aligned_swap_contig_to_strided_size8;
#endif

#line 611
#if 1 || 16 > 2
                case 16:
                    return &_aligned_swap_contig_to_strided_size16;
#endif

                }

                return  &_swap_strided_to_strided;
            }
            else {
                switch (itemsize) {
#line 625
#if 1 || 2 > 2
                case 2:
                    return &_aligned_swap_strided_to_strided_size2;
#endif

#line 625
#if 1 || 4 > 2
                case 4:
                    return &_aligned_swap_strided_to_strided_size4;
#endif

#line 625
#if 1 || 8 > 2
                case 8:
                    return &_aligned_swap_strided_to_strided_size8;
#endif

#line 625
#if 1 || 16 > 2
                case 16:
                    return &_aligned_swap_strided_to_strided_size16;
#endif

                }
            }
        }

#if !NPY_USE_UNALIGNED_ACCESS
    }
    else {
        /* contiguous dst */
        if (itemsize != 0 && dst_stride == itemsize) {
            /* contiguous src */
            if (src_stride == itemsize) {
                switch (itemsize) {
#line 645
#if 1 || 2 > 2
                case 2:
                    return &_swap_contig_to_contig_size2;
#endif

#line 645
#if 1 || 4 > 2
                case 4:
                    return &_swap_contig_to_contig_size4;
#endif

#line 645
#if 1 || 8 > 2
                case 8:
                    return &_swap_contig_to_contig_size8;
#endif

#line 645
#if 1 || 16 > 2
                case 16:
                    return &_swap_contig_to_contig_size16;
#endif

                }
            }
            /* general src */
            else {
                switch (itemsize) {
#line 658
#if 1 || 2 > 2
                    case 2:
                        return &_swap_strided_to_contig_size2;
#endif

#line 658
#if 1 || 4 > 2
                    case 4:
                        return &_swap_strided_to_contig_size4;
#endif

#line 658
#if 1 || 8 > 2
                    case 8:
                        return &_swap_strided_to_contig_size8;
#endif

#line 658
#if 1 || 16 > 2
                    case 16:
                        return &_swap_strided_to_contig_size16;
#endif

                }
            }

            return  &_swap_strided_to_strided;
        }
        /* general dst */
        else {
            /* contiguous src */
            if (itemsize != 0 && src_stride == itemsize) {
                switch (itemsize) {
#line 676
#if 1 || 2 > 2
                case 2:
                    return &_swap_contig_to_strided_size2;
#endif

#line 676
#if 1 || 4 > 2
                case 4:
                    return &_swap_contig_to_strided_size4;
#endif

#line 676
#if 1 || 8 > 2
                case 8:
                    return &_swap_contig_to_strided_size8;
#endif

#line 676
#if 1 || 16 > 2
                case 16:
                    return &_swap_contig_to_strided_size16;
#endif

                }

                return  &_swap_strided_to_strided;
            }
            /* general src */
            else {
                switch (itemsize) {
#line 691
#if 1 || 2 > 2
                case 2:
                    return &_swap_strided_to_strided_size2;
#endif

#line 691
#if 1 || 4 > 2
                case 4:
                    return &_swap_strided_to_strided_size4;
#endif

#line 691
#if 1 || 8 > 2
                case 8:
                    return &_swap_strided_to_strided_size8;
#endif

#line 691
#if 1 || 16 > 2
                case 16:
                    return &_swap_strided_to_strided_size16;
#endif

                }
            }
        }
    }
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

    return &_swap_strided_to_strided;
}


#line 533

NPY_NO_EXPORT PyArrayMethod_StridedLoop *
PyArray_GetStridedCopySwapPairFn(int aligned, npy_intp src_stride,
                             npy_intp dst_stride, npy_intp itemsize)
{
/*
 * Skip the "unaligned" versions on CPUs which support unaligned
 * memory accesses.
 */
#if !NPY_USE_UNALIGNED_ACCESS
    if (aligned) {
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

        /* contiguous dst */
        if (itemsize != 0 && dst_stride == itemsize) {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 554
#if 0 || 2 > 2
                case 2:
                    return
                 &_aligned_swap_pair_strided_to_contig_size2_srcstride0;
#endif

#line 554
#if 0 || 4 > 2
                case 4:
                    return
                 &_aligned_swap_pair_strided_to_contig_size4_srcstride0;
#endif

#line 554
#if 0 || 8 > 2
                case 8:
                    return
                 &_aligned_swap_pair_strided_to_contig_size8_srcstride0;
#endif

#line 554
#if 0 || 16 > 2
                case 16:
                    return
                 &_aligned_swap_pair_strided_to_contig_size16_srcstride0;
#endif

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                switch (itemsize) {
#line 568
#if 0 || 2 > 2
                case 2:
                    return &_aligned_swap_pair_contig_to_contig_size2;
#endif

#line 568
#if 0 || 4 > 2
                case 4:
                    return &_aligned_swap_pair_contig_to_contig_size4;
#endif

#line 568
#if 0 || 8 > 2
                case 8:
                    return &_aligned_swap_pair_contig_to_contig_size8;
#endif

#line 568
#if 0 || 16 > 2
                case 16:
                    return &_aligned_swap_pair_contig_to_contig_size16;
#endif

                }
            }
            /* general src */
            else {
                switch (itemsize) {
#line 581
#if 0 || 2 > 2
                case 2:
                    return &_aligned_swap_pair_strided_to_contig_size2;
#endif

#line 581
#if 0 || 4 > 2
                case 4:
                    return &_aligned_swap_pair_strided_to_contig_size4;
#endif

#line 581
#if 0 || 8 > 2
                case 8:
                    return &_aligned_swap_pair_strided_to_contig_size8;
#endif

#line 581
#if 0 || 16 > 2
                case 16:
                    return &_aligned_swap_pair_strided_to_contig_size16;
#endif

                }
            }
        }
        /* general dst */
        else {
            /* constant src */
            if (src_stride == 0) {
                switch (itemsize) {
#line 597
#if 0 || 2 > 2
                case 2:
                    return
                &_aligned_swap_pair_strided_to_strided_size2_srcstride0;
#endif

#line 597
#if 0 || 4 > 2
                case 4:
                    return
                &_aligned_swap_pair_strided_to_strided_size4_srcstride0;
#endif

#line 597
#if 0 || 8 > 2
                case 8:
                    return
                &_aligned_swap_pair_strided_to_strided_size8_srcstride0;
#endif

#line 597
#if 0 || 16 > 2
                case 16:
                    return
                &_aligned_swap_pair_strided_to_strided_size16_srcstride0;
#endif

                }
            }
            /* contiguous src */
            else if (src_stride == itemsize) {
                switch (itemsize) {
#line 611
#if 0 || 2 > 2
                case 2:
                    return &_aligned_swap_pair_contig_to_strided_size2;
#endif

#line 611
#if 0 || 4 > 2
                case 4:
                    return &_aligned_swap_pair_contig_to_strided_size4;
#endif

#line 611
#if 0 || 8 > 2
                case 8:
                    return &_aligned_swap_pair_contig_to_strided_size8;
#endif

#line 611
#if 0 || 16 > 2
                case 16:
                    return &_aligned_swap_pair_contig_to_strided_size16;
#endif

                }

                return  &_swap_pair_strided_to_strided;
            }
            else {
                switch (itemsize) {
#line 625
#if 0 || 2 > 2
                case 2:
                    return &_aligned_swap_pair_strided_to_strided_size2;
#endif

#line 625
#if 0 || 4 > 2
                case 4:
                    return &_aligned_swap_pair_strided_to_strided_size4;
#endif

#line 625
#if 0 || 8 > 2
                case 8:
                    return &_aligned_swap_pair_strided_to_strided_size8;
#endif

#line 625
#if 0 || 16 > 2
                case 16:
                    return &_aligned_swap_pair_strided_to_strided_size16;
#endif

                }
            }
        }

#if !NPY_USE_UNALIGNED_ACCESS
    }
    else {
        /* contiguous dst */
        if (itemsize != 0 && dst_stride == itemsize) {
            /* contiguous src */
            if (src_stride == itemsize) {
                switch (itemsize) {
#line 645
#if 0 || 2 > 2
                case 2:
                    return &_swap_pair_contig_to_contig_size2;
#endif

#line 645
#if 0 || 4 > 2
                case 4:
                    return &_swap_pair_contig_to_contig_size4;
#endif

#line 645
#if 0 || 8 > 2
                case 8:
                    return &_swap_pair_contig_to_contig_size8;
#endif

#line 645
#if 0 || 16 > 2
                case 16:
                    return &_swap_pair_contig_to_contig_size16;
#endif

                }
            }
            /* general src */
            else {
                switch (itemsize) {
#line 658
#if 0 || 2 > 2
                    case 2:
                        return &_swap_pair_strided_to_contig_size2;
#endif

#line 658
#if 0 || 4 > 2
                    case 4:
                        return &_swap_pair_strided_to_contig_size4;
#endif

#line 658
#if 0 || 8 > 2
                    case 8:
                        return &_swap_pair_strided_to_contig_size8;
#endif

#line 658
#if 0 || 16 > 2
                    case 16:
                        return &_swap_pair_strided_to_contig_size16;
#endif

                }
            }

            return  &_swap_pair_strided_to_strided;
        }
        /* general dst */
        else {
            /* contiguous src */
            if (itemsize != 0 && src_stride == itemsize) {
                switch (itemsize) {
#line 676
#if 0 || 2 > 2
                case 2:
                    return &_swap_pair_contig_to_strided_size2;
#endif

#line 676
#if 0 || 4 > 2
                case 4:
                    return &_swap_pair_contig_to_strided_size4;
#endif

#line 676
#if 0 || 8 > 2
                case 8:
                    return &_swap_pair_contig_to_strided_size8;
#endif

#line 676
#if 0 || 16 > 2
                case 16:
                    return &_swap_pair_contig_to_strided_size16;
#endif

                }

                return  &_swap_pair_strided_to_strided;
            }
            /* general src */
            else {
                switch (itemsize) {
#line 691
#if 0 || 2 > 2
                case 2:
                    return &_swap_pair_strided_to_strided_size2;
#endif

#line 691
#if 0 || 4 > 2
                case 4:
                    return &_swap_pair_strided_to_strided_size4;
#endif

#line 691
#if 0 || 8 > 2
                case 8:
                    return &_swap_pair_strided_to_strided_size8;
#endif

#line 691
#if 0 || 16 > 2
                case 16:
                    return &_swap_pair_strided_to_strided_size16;
#endif

                }
            }
        }
    }
#endif/*!NPY_USE_UNALIGNED_ACCESS*/

    return &_swap_pair_strided_to_strided;
}



/************* STRIDED CASTING SPECIALIZED FUNCTIONS *************/

#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_bool_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_bool_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_bool_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_bool_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_bool_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_bool_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_bool
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_bool
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 1
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_bool_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_bool_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_bool);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ubyte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ubyte_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ubyte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ubyte_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ubyte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ubyte_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ubyte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ubyte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ubyte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ubyte_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ubyte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ushort_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ushort_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ushort_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ushort_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ushort_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ushort_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ushort
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ushort
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ushort_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ushort_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ushort);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_uint_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_uint_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_uint_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_uint_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_uint_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_uint_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_uint
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_uint
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_uint_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_uint_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_uint);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_ulonglong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_ulonglong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_ulonglong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_ulonglong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_ulonglong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_ulonglong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_ulonglong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_ulonglong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_ulonglong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_ulonglong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_ulonglong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_byte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_byte_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_byte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_byte_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_byte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_byte_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_byte
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_byte
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_byte_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_byte_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_byte);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_short_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_short_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_short_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_short_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_short_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_short_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_short
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_short
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_short_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_short_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_short);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_int_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_int_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_int_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_int_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_int_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_int_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_int
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_int
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_int_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_int_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_int);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_long_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_long_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_long_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_long_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_long_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_long_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_long
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_long
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_long_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_long_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_long);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longlong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longlong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longlong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longlong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longlong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longlong_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longlong
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longlong
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longlong_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longlong_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longlong);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_half_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_half_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_half_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_half_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_half_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_half_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 1 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_half
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_half
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 1

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_half_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_half_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_half);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_float_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_float_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_float_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_float_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_float_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_float_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_float_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_float_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_float);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_double_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_double_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_double_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_double_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_double_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_double_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_double_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_double_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_double);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_longdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_longdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_longdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_longdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_longdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_longdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_longdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 0
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_longdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 0
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 0
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_longdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cfloat_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cfloat_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cfloat_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cfloat_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cfloat_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cfloat_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 1
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_float
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_float
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 1
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cfloat_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cfloat_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cfloat);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_cdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_cdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_cdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_cdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_cdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_cdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 1
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_double
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_double
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_cdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_cdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_cdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif






#line 737

#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_bool);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_bool\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_bool
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_bool

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 1
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 1 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_bool(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_bool\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 1
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 1
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_bool);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_ubyte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ubyte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ubyte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_ubyte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_ubyte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ubyte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ushort);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_ushort\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ushort
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ushort

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_ushort(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_ushort\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ushort);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_uint);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_uint\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_uint
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_uint

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_uint(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_uint\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_uint);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_ulong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_ulong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_ulong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_ulonglong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_ulonglong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_ulonglong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_ulonglong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_ulonglong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_ulonglong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_byte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_byte\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_byte
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_byte

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_byte(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_byte\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_byte);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_short);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_short\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_short
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_short

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_short(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_short\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_short);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_int);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_int\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_int
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_int

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_int(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_int\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_int);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_long);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_long\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_long
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_long

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_long(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_long\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_long);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longlong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_longlong\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longlong
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longlong

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_longlong(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_longlong\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longlong);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_half);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_half\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 1

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_half
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_half

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 1
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 1

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_half(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_half\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_half);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_float);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_float\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_float(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_float\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_float);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_double);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_double\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_double(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_double\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_double);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_longdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_longdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 0
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_longdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 0
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 0
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 0
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_longdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_cfloat\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 1
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_float
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_float

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 1
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_cfloat(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_cfloat\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cfloat);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_cdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 1
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_double
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_double

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 1
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_cdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_cdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_cdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif




#line 766

#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_cast_clongdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_cast_clongdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_cast_clongdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !0
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_cast_clongdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 0
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !1)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_aligned_contig_cast_clongdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !1
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !1
    _TYPE2 dst_value;
#endif

#if 1
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_aligned_contig_cast_clongdouble_to_clongdouble\n");*/

    while (N--) {
#if 1
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !1
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !1
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !1
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 1
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif


#line 772

#if !(NPY_USE_UNALIGNED_ACCESS && !0)

/* For half types, don't use actual double/float types in conversion */
#if 0 || 0

#  if 0
#    define _TYPE1 npy_uint32
#  elif 0
#    define _TYPE1 npy_uint64
#  else
#    define _TYPE1 npy_longdouble
#  endif

#  if 0
#    define _TYPE2 npy_uint32
#  elif 0
#    define _TYPE2 npy_uint64
#  else
#    define _TYPE2 npy_longdouble
#  endif

#else

#define _TYPE1 npy_longdouble
#define _TYPE2 npy_longdouble

#endif

/* Determine an appropriate casting conversion function */
#if 0

#  if 0
#    define _CONVERT_FN(x) npy_halfbits_to_floatbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_halfbits_to_doublebits(x)
#  elif 0
#    define _CONVERT_FN(x) (x)
#  elif 0
#    define _CONVERT_FN(x) ((npy_bool)!npy_half_iszero(x))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)npy_half_to_float(x))
#  endif

#elif 0

#  if 0
#    define _CONVERT_FN(x) npy_floatbits_to_halfbits(x)
#  elif 0
#    define _CONVERT_FN(x) npy_doublebits_to_halfbits(x)
#  else
#    define _CONVERT_FN(x) npy_float_to_half((float)x)
#  endif

#else

#  if 0 || 0
#    define _CONVERT_FN(x) ((npy_bool)(x != 0))
#  else
#    define _CONVERT_FN(x) ((_TYPE2)x)
#  endif

#endif

static NPY_GCC_OPT_3 int
_contig_cast_clongdouble_to_clongdouble(
        PyArrayMethod_Context *context, char *const *args,
        const npy_intp *dimensions, const npy_intp *strides,
        NpyAuxData *NPY_UNUSED(data))
{
    npy_intp N = dimensions[0];
    char *src = args[0], *dst = args[1];
#if !1
    npy_intp src_stride = strides[0], dst_stride = strides[1];
#endif

#if 1
    _TYPE1 src_value[2];
#elif !0
    _TYPE1 src_value;
#endif
#if 1
    _TYPE2 dst_value[2];
#elif !0
    _TYPE2 dst_value;
#endif

#if 0
   /* sanity check */
    assert(N == 0 || npy_is_aligned(src, _ALIGN(_TYPE1)));
    assert(N == 0 || npy_is_aligned(dst, _ALIGN(_TYPE2)));
#endif

    /*printf("_contig_cast_clongdouble_to_clongdouble\n");*/

    while (N--) {
#if 0
#  if 1
        src_value[0] = ((_TYPE1 *)src)[0];
        src_value[1] = ((_TYPE1 *)src)[1];
#  endif
#else
        memmove(&src_value, src, sizeof(src_value));
#endif

/* Do the cast */
#if 1
#  if 1
    dst_value[0] = _CONVERT_FN(src_value[0]);
    dst_value[1] = _CONVERT_FN(src_value[1]);
#  elif !0
#    if 0
       dst_value = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       dst_value = _CONVERT_FN(src_value[0]);
#    endif
#  else
#    if 0
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) || _CONVERT_FN(src_value[1]);
#    else
       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
#    endif
#  endif
#else
#  if 1
#    if !0
    dst_value[0] = _CONVERT_FN(src_value);
#    else
    dst_value[0] = _CONVERT_FN(*(_TYPE1 *)src);
#    endif
    dst_value[1] = 0;
#  elif !0
    dst_value = _CONVERT_FN(src_value);
#  else
    *(_TYPE2 *)dst = _CONVERT_FN(*(_TYPE1 *)src);
#  endif
#endif

#if 0
#  if 1
        ((_TYPE2 *)dst)[0] = dst_value[0];
        ((_TYPE2 *)dst)[1] = dst_value[1];
#  endif
#else
        memmove(dst, &dst_value, sizeof(dst_value));
#endif

#if 1
        dst += sizeof(npy_clongdouble);
        src += sizeof(npy_clongdouble);
#else
        dst += dst_stride;
        src += src_stride;
#endif
    }
    return 0;
}

#undef _CONVERT_FN
#undef _TYPE2
#undef _TYPE1

#endif







NPY_NO_EXPORT PyArrayMethod_StridedLoop *
PyArray_GetStridedNumericCastFn(int aligned, npy_intp src_stride,
                             npy_intp dst_stride,
                             int src_type_num, int dst_type_num)
{
    switch (src_type_num) {
#line 966

        case NPY_BOOL:
            /*printf("test fn %d - second %d\n", NPY_BOOL, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_bool_to_bool;
                    }
                    else {
                        return &_aligned_cast_bool_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_bool :
                                    &_contig_cast_bool_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_bool :
                                         &_cast_bool_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_bool_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_bool_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_ubyte :
                                    &_contig_cast_bool_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_ubyte :
                                         &_cast_bool_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_bool_to_ushort;
                    }
                    else {
                        return &_aligned_cast_bool_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_ushort :
                                    &_contig_cast_bool_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_ushort :
                                         &_cast_bool_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_bool_to_uint;
                    }
                    else {
                        return &_aligned_cast_bool_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_uint :
                                    &_contig_cast_bool_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_uint :
                                         &_cast_bool_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_bool_to_ulong;
                    }
                    else {
                        return &_aligned_cast_bool_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_ulong :
                                    &_contig_cast_bool_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_ulong :
                                         &_cast_bool_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_bool_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_bool_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_ulonglong :
                                    &_contig_cast_bool_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_ulonglong :
                                         &_cast_bool_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_bool_to_byte;
                    }
                    else {
                        return &_aligned_cast_bool_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_byte :
                                    &_contig_cast_bool_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_byte :
                                         &_cast_bool_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_bool_to_short;
                    }
                    else {
                        return &_aligned_cast_bool_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_short :
                                    &_contig_cast_bool_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_short :
                                         &_cast_bool_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_bool_to_int;
                    }
                    else {
                        return &_aligned_cast_bool_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_int :
                                    &_contig_cast_bool_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_int :
                                         &_cast_bool_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_bool_to_long;
                    }
                    else {
                        return &_aligned_cast_bool_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_long :
                                    &_contig_cast_bool_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_long :
                                         &_cast_bool_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_bool_to_longlong;
                    }
                    else {
                        return &_aligned_cast_bool_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_longlong :
                                    &_contig_cast_bool_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_longlong :
                                         &_cast_bool_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_bool_to_half;
                    }
                    else {
                        return &_aligned_cast_bool_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_half :
                                    &_contig_cast_bool_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_half :
                                         &_cast_bool_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_bool_to_float;
                    }
                    else {
                        return &_aligned_cast_bool_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_float :
                                    &_contig_cast_bool_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_float :
                                         &_cast_bool_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_bool_to_double;
                    }
                    else {
                        return &_aligned_cast_bool_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_double :
                                    &_contig_cast_bool_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_double :
                                         &_cast_bool_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_bool_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_bool_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_longdouble :
                                    &_contig_cast_bool_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_longdouble :
                                         &_cast_bool_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_bool_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_bool_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_cfloat :
                                    &_contig_cast_bool_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_cfloat :
                                         &_cast_bool_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_bool_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_bool_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_cdouble :
                                    &_contig_cast_bool_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_cdouble :
                                         &_cast_bool_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BOOL, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_bool_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_bool_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_bool) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_bool_to_clongdouble :
                                    &_contig_cast_bool_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_bool_to_clongdouble :
                                         &_cast_bool_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_BOOL, dst_type_num);*/


#line 966

        case NPY_UBYTE:
            /*printf("test fn %d - second %d\n", NPY_UBYTE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_ubyte_to_bool;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_bool :
                                    &_contig_cast_ubyte_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_bool :
                                         &_cast_ubyte_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_ubyte_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_ubyte :
                                    &_contig_cast_ubyte_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_ubyte :
                                         &_cast_ubyte_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_ubyte_to_ushort;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_ushort :
                                    &_contig_cast_ubyte_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_ushort :
                                         &_cast_ubyte_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_ubyte_to_uint;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_uint :
                                    &_contig_cast_ubyte_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_uint :
                                         &_cast_ubyte_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_ubyte_to_ulong;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_ulong :
                                    &_contig_cast_ubyte_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_ulong :
                                         &_cast_ubyte_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_ubyte_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_ulonglong :
                                    &_contig_cast_ubyte_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_ulonglong :
                                         &_cast_ubyte_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_ubyte_to_byte;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_byte :
                                    &_contig_cast_ubyte_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_byte :
                                         &_cast_ubyte_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_ubyte_to_short;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_short :
                                    &_contig_cast_ubyte_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_short :
                                         &_cast_ubyte_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_ubyte_to_int;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_int :
                                    &_contig_cast_ubyte_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_int :
                                         &_cast_ubyte_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_ubyte_to_long;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_long :
                                    &_contig_cast_ubyte_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_long :
                                         &_cast_ubyte_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_ubyte_to_longlong;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_longlong :
                                    &_contig_cast_ubyte_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_longlong :
                                         &_cast_ubyte_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_ubyte_to_half;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_half :
                                    &_contig_cast_ubyte_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_half :
                                         &_cast_ubyte_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_ubyte_to_float;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_float :
                                    &_contig_cast_ubyte_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_float :
                                         &_cast_ubyte_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_ubyte_to_double;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_double :
                                    &_contig_cast_ubyte_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_double :
                                         &_cast_ubyte_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_ubyte_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_longdouble :
                                    &_contig_cast_ubyte_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_longdouble :
                                         &_cast_ubyte_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_ubyte_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_cfloat :
                                    &_contig_cast_ubyte_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_cfloat :
                                         &_cast_ubyte_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_ubyte_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_cdouble :
                                    &_contig_cast_ubyte_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_cdouble :
                                         &_cast_ubyte_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UBYTE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_ubyte_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_ubyte_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ubyte) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ubyte_to_clongdouble :
                                    &_contig_cast_ubyte_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ubyte_to_clongdouble :
                                         &_cast_ubyte_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_UBYTE, dst_type_num);*/


#line 966

        case NPY_USHORT:
            /*printf("test fn %d - second %d\n", NPY_USHORT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_ushort_to_bool;
                    }
                    else {
                        return &_aligned_cast_ushort_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_bool :
                                    &_contig_cast_ushort_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_bool :
                                         &_cast_ushort_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_ushort_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_ushort_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_ubyte :
                                    &_contig_cast_ushort_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_ubyte :
                                         &_cast_ushort_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_ushort_to_ushort;
                    }
                    else {
                        return &_aligned_cast_ushort_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_ushort :
                                    &_contig_cast_ushort_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_ushort :
                                         &_cast_ushort_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_ushort_to_uint;
                    }
                    else {
                        return &_aligned_cast_ushort_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_uint :
                                    &_contig_cast_ushort_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_uint :
                                         &_cast_ushort_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_ushort_to_ulong;
                    }
                    else {
                        return &_aligned_cast_ushort_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_ulong :
                                    &_contig_cast_ushort_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_ulong :
                                         &_cast_ushort_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_ushort_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_ushort_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_ulonglong :
                                    &_contig_cast_ushort_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_ulonglong :
                                         &_cast_ushort_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_ushort_to_byte;
                    }
                    else {
                        return &_aligned_cast_ushort_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_byte :
                                    &_contig_cast_ushort_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_byte :
                                         &_cast_ushort_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_ushort_to_short;
                    }
                    else {
                        return &_aligned_cast_ushort_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_short :
                                    &_contig_cast_ushort_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_short :
                                         &_cast_ushort_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_ushort_to_int;
                    }
                    else {
                        return &_aligned_cast_ushort_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_int :
                                    &_contig_cast_ushort_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_int :
                                         &_cast_ushort_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_ushort_to_long;
                    }
                    else {
                        return &_aligned_cast_ushort_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_long :
                                    &_contig_cast_ushort_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_long :
                                         &_cast_ushort_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_ushort_to_longlong;
                    }
                    else {
                        return &_aligned_cast_ushort_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_longlong :
                                    &_contig_cast_ushort_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_longlong :
                                         &_cast_ushort_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_ushort_to_half;
                    }
                    else {
                        return &_aligned_cast_ushort_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_half :
                                    &_contig_cast_ushort_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_half :
                                         &_cast_ushort_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_ushort_to_float;
                    }
                    else {
                        return &_aligned_cast_ushort_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_float :
                                    &_contig_cast_ushort_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_float :
                                         &_cast_ushort_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_ushort_to_double;
                    }
                    else {
                        return &_aligned_cast_ushort_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_double :
                                    &_contig_cast_ushort_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_double :
                                         &_cast_ushort_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_ushort_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_ushort_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_longdouble :
                                    &_contig_cast_ushort_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_longdouble :
                                         &_cast_ushort_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_ushort_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_ushort_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_cfloat :
                                    &_contig_cast_ushort_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_cfloat :
                                         &_cast_ushort_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_ushort_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_ushort_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_cdouble :
                                    &_contig_cast_ushort_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_cdouble :
                                         &_cast_ushort_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_USHORT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_ushort_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_ushort_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ushort) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ushort_to_clongdouble :
                                    &_contig_cast_ushort_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ushort_to_clongdouble :
                                         &_cast_ushort_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_USHORT, dst_type_num);*/


#line 966

        case NPY_UINT:
            /*printf("test fn %d - second %d\n", NPY_UINT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_uint_to_bool;
                    }
                    else {
                        return &_aligned_cast_uint_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_bool :
                                    &_contig_cast_uint_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_bool :
                                         &_cast_uint_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_uint_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_uint_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_ubyte :
                                    &_contig_cast_uint_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_ubyte :
                                         &_cast_uint_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_uint_to_ushort;
                    }
                    else {
                        return &_aligned_cast_uint_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_ushort :
                                    &_contig_cast_uint_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_ushort :
                                         &_cast_uint_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_uint_to_uint;
                    }
                    else {
                        return &_aligned_cast_uint_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_uint :
                                    &_contig_cast_uint_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_uint :
                                         &_cast_uint_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_uint_to_ulong;
                    }
                    else {
                        return &_aligned_cast_uint_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_ulong :
                                    &_contig_cast_uint_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_ulong :
                                         &_cast_uint_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_uint_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_uint_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_ulonglong :
                                    &_contig_cast_uint_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_ulonglong :
                                         &_cast_uint_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_uint_to_byte;
                    }
                    else {
                        return &_aligned_cast_uint_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_byte :
                                    &_contig_cast_uint_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_byte :
                                         &_cast_uint_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_uint_to_short;
                    }
                    else {
                        return &_aligned_cast_uint_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_short :
                                    &_contig_cast_uint_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_short :
                                         &_cast_uint_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_uint_to_int;
                    }
                    else {
                        return &_aligned_cast_uint_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_int :
                                    &_contig_cast_uint_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_int :
                                         &_cast_uint_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_uint_to_long;
                    }
                    else {
                        return &_aligned_cast_uint_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_long :
                                    &_contig_cast_uint_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_long :
                                         &_cast_uint_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_uint_to_longlong;
                    }
                    else {
                        return &_aligned_cast_uint_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_longlong :
                                    &_contig_cast_uint_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_longlong :
                                         &_cast_uint_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_uint_to_half;
                    }
                    else {
                        return &_aligned_cast_uint_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_half :
                                    &_contig_cast_uint_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_half :
                                         &_cast_uint_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_uint_to_float;
                    }
                    else {
                        return &_aligned_cast_uint_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_float :
                                    &_contig_cast_uint_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_float :
                                         &_cast_uint_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_uint_to_double;
                    }
                    else {
                        return &_aligned_cast_uint_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_double :
                                    &_contig_cast_uint_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_double :
                                         &_cast_uint_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_uint_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_uint_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_longdouble :
                                    &_contig_cast_uint_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_longdouble :
                                         &_cast_uint_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_uint_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_uint_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_cfloat :
                                    &_contig_cast_uint_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_cfloat :
                                         &_cast_uint_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_uint_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_uint_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_cdouble :
                                    &_contig_cast_uint_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_cdouble :
                                         &_cast_uint_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_UINT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_uint_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_uint_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_uint) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_uint_to_clongdouble :
                                    &_contig_cast_uint_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_uint_to_clongdouble :
                                         &_cast_uint_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_UINT, dst_type_num);*/


#line 966

        case NPY_ULONG:
            /*printf("test fn %d - second %d\n", NPY_ULONG, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_ulong_to_bool;
                    }
                    else {
                        return &_aligned_cast_ulong_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_bool :
                                    &_contig_cast_ulong_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_bool :
                                         &_cast_ulong_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_ulong_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_ulong_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_ubyte :
                                    &_contig_cast_ulong_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_ubyte :
                                         &_cast_ulong_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_ulong_to_ushort;
                    }
                    else {
                        return &_aligned_cast_ulong_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_ushort :
                                    &_contig_cast_ulong_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_ushort :
                                         &_cast_ulong_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_ulong_to_uint;
                    }
                    else {
                        return &_aligned_cast_ulong_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_uint :
                                    &_contig_cast_ulong_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_uint :
                                         &_cast_ulong_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_ulong_to_ulong;
                    }
                    else {
                        return &_aligned_cast_ulong_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_ulong :
                                    &_contig_cast_ulong_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_ulong :
                                         &_cast_ulong_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_ulong_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_ulong_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_ulonglong :
                                    &_contig_cast_ulong_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_ulonglong :
                                         &_cast_ulong_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_ulong_to_byte;
                    }
                    else {
                        return &_aligned_cast_ulong_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_byte :
                                    &_contig_cast_ulong_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_byte :
                                         &_cast_ulong_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_ulong_to_short;
                    }
                    else {
                        return &_aligned_cast_ulong_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_short :
                                    &_contig_cast_ulong_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_short :
                                         &_cast_ulong_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_ulong_to_int;
                    }
                    else {
                        return &_aligned_cast_ulong_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_int :
                                    &_contig_cast_ulong_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_int :
                                         &_cast_ulong_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_ulong_to_long;
                    }
                    else {
                        return &_aligned_cast_ulong_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_long :
                                    &_contig_cast_ulong_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_long :
                                         &_cast_ulong_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_ulong_to_longlong;
                    }
                    else {
                        return &_aligned_cast_ulong_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_longlong :
                                    &_contig_cast_ulong_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_longlong :
                                         &_cast_ulong_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_ulong_to_half;
                    }
                    else {
                        return &_aligned_cast_ulong_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_half :
                                    &_contig_cast_ulong_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_half :
                                         &_cast_ulong_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_ulong_to_float;
                    }
                    else {
                        return &_aligned_cast_ulong_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_float :
                                    &_contig_cast_ulong_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_float :
                                         &_cast_ulong_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_ulong_to_double;
                    }
                    else {
                        return &_aligned_cast_ulong_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_double :
                                    &_contig_cast_ulong_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_double :
                                         &_cast_ulong_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_ulong_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_ulong_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_longdouble :
                                    &_contig_cast_ulong_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_longdouble :
                                         &_cast_ulong_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_ulong_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_ulong_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_cfloat :
                                    &_contig_cast_ulong_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_cfloat :
                                         &_cast_ulong_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_ulong_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_ulong_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_cdouble :
                                    &_contig_cast_ulong_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_cdouble :
                                         &_cast_ulong_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONG, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_ulong_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_ulong_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulong_to_clongdouble :
                                    &_contig_cast_ulong_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulong_to_clongdouble :
                                         &_cast_ulong_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_ULONG, dst_type_num);*/


#line 966

        case NPY_ULONGLONG:
            /*printf("test fn %d - second %d\n", NPY_ULONGLONG, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_ulonglong_to_bool;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_bool :
                                    &_contig_cast_ulonglong_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_bool :
                                         &_cast_ulonglong_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_ulonglong_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_ubyte :
                                    &_contig_cast_ulonglong_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_ubyte :
                                         &_cast_ulonglong_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_ulonglong_to_ushort;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_ushort :
                                    &_contig_cast_ulonglong_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_ushort :
                                         &_cast_ulonglong_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_ulonglong_to_uint;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_uint :
                                    &_contig_cast_ulonglong_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_uint :
                                         &_cast_ulonglong_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_ulonglong_to_ulong;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_ulong :
                                    &_contig_cast_ulonglong_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_ulong :
                                         &_cast_ulonglong_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_ulonglong_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_ulonglong :
                                    &_contig_cast_ulonglong_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_ulonglong :
                                         &_cast_ulonglong_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_ulonglong_to_byte;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_byte :
                                    &_contig_cast_ulonglong_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_byte :
                                         &_cast_ulonglong_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_ulonglong_to_short;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_short :
                                    &_contig_cast_ulonglong_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_short :
                                         &_cast_ulonglong_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_ulonglong_to_int;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_int :
                                    &_contig_cast_ulonglong_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_int :
                                         &_cast_ulonglong_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_ulonglong_to_long;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_long :
                                    &_contig_cast_ulonglong_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_long :
                                         &_cast_ulonglong_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_ulonglong_to_longlong;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_longlong :
                                    &_contig_cast_ulonglong_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_longlong :
                                         &_cast_ulonglong_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_ulonglong_to_half;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_half :
                                    &_contig_cast_ulonglong_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_half :
                                         &_cast_ulonglong_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_ulonglong_to_float;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_float :
                                    &_contig_cast_ulonglong_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_float :
                                         &_cast_ulonglong_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_ulonglong_to_double;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_double :
                                    &_contig_cast_ulonglong_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_double :
                                         &_cast_ulonglong_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_ulonglong_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_longdouble :
                                    &_contig_cast_ulonglong_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_longdouble :
                                         &_cast_ulonglong_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_ulonglong_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_cfloat :
                                    &_contig_cast_ulonglong_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_cfloat :
                                         &_cast_ulonglong_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_ulonglong_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_cdouble :
                                    &_contig_cast_ulonglong_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_cdouble :
                                         &_cast_ulonglong_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_ULONGLONG, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_ulonglong_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_ulonglong_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_ulonglong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_ulonglong_to_clongdouble :
                                    &_contig_cast_ulonglong_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_ulonglong_to_clongdouble :
                                         &_cast_ulonglong_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_ULONGLONG, dst_type_num);*/


#line 966

        case NPY_BYTE:
            /*printf("test fn %d - second %d\n", NPY_BYTE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_byte_to_bool;
                    }
                    else {
                        return &_aligned_cast_byte_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_bool :
                                    &_contig_cast_byte_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_bool :
                                         &_cast_byte_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_byte_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_byte_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_ubyte :
                                    &_contig_cast_byte_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_ubyte :
                                         &_cast_byte_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_byte_to_ushort;
                    }
                    else {
                        return &_aligned_cast_byte_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_ushort :
                                    &_contig_cast_byte_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_ushort :
                                         &_cast_byte_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_byte_to_uint;
                    }
                    else {
                        return &_aligned_cast_byte_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_uint :
                                    &_contig_cast_byte_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_uint :
                                         &_cast_byte_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_byte_to_ulong;
                    }
                    else {
                        return &_aligned_cast_byte_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_ulong :
                                    &_contig_cast_byte_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_ulong :
                                         &_cast_byte_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_byte_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_byte_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_ulonglong :
                                    &_contig_cast_byte_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_ulonglong :
                                         &_cast_byte_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_byte_to_byte;
                    }
                    else {
                        return &_aligned_cast_byte_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_byte :
                                    &_contig_cast_byte_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_byte :
                                         &_cast_byte_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_byte_to_short;
                    }
                    else {
                        return &_aligned_cast_byte_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_short :
                                    &_contig_cast_byte_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_short :
                                         &_cast_byte_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_byte_to_int;
                    }
                    else {
                        return &_aligned_cast_byte_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_int :
                                    &_contig_cast_byte_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_int :
                                         &_cast_byte_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_byte_to_long;
                    }
                    else {
                        return &_aligned_cast_byte_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_long :
                                    &_contig_cast_byte_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_long :
                                         &_cast_byte_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_byte_to_longlong;
                    }
                    else {
                        return &_aligned_cast_byte_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_longlong :
                                    &_contig_cast_byte_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_longlong :
                                         &_cast_byte_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_byte_to_half;
                    }
                    else {
                        return &_aligned_cast_byte_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_half :
                                    &_contig_cast_byte_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_half :
                                         &_cast_byte_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_byte_to_float;
                    }
                    else {
                        return &_aligned_cast_byte_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_float :
                                    &_contig_cast_byte_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_float :
                                         &_cast_byte_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_byte_to_double;
                    }
                    else {
                        return &_aligned_cast_byte_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_double :
                                    &_contig_cast_byte_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_double :
                                         &_cast_byte_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_byte_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_byte_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_longdouble :
                                    &_contig_cast_byte_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_longdouble :
                                         &_cast_byte_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_byte_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_byte_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_cfloat :
                                    &_contig_cast_byte_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_cfloat :
                                         &_cast_byte_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_byte_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_byte_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_cdouble :
                                    &_contig_cast_byte_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_cdouble :
                                         &_cast_byte_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_BYTE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_byte_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_byte_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_byte) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_byte_to_clongdouble :
                                    &_contig_cast_byte_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_byte_to_clongdouble :
                                         &_cast_byte_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_BYTE, dst_type_num);*/


#line 966

        case NPY_SHORT:
            /*printf("test fn %d - second %d\n", NPY_SHORT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_short_to_bool;
                    }
                    else {
                        return &_aligned_cast_short_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_bool :
                                    &_contig_cast_short_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_bool :
                                         &_cast_short_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_short_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_short_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_ubyte :
                                    &_contig_cast_short_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_ubyte :
                                         &_cast_short_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_short_to_ushort;
                    }
                    else {
                        return &_aligned_cast_short_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_ushort :
                                    &_contig_cast_short_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_ushort :
                                         &_cast_short_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_short_to_uint;
                    }
                    else {
                        return &_aligned_cast_short_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_uint :
                                    &_contig_cast_short_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_uint :
                                         &_cast_short_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_short_to_ulong;
                    }
                    else {
                        return &_aligned_cast_short_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_ulong :
                                    &_contig_cast_short_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_ulong :
                                         &_cast_short_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_short_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_short_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_ulonglong :
                                    &_contig_cast_short_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_ulonglong :
                                         &_cast_short_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_short_to_byte;
                    }
                    else {
                        return &_aligned_cast_short_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_byte :
                                    &_contig_cast_short_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_byte :
                                         &_cast_short_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_short_to_short;
                    }
                    else {
                        return &_aligned_cast_short_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_short :
                                    &_contig_cast_short_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_short :
                                         &_cast_short_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_short_to_int;
                    }
                    else {
                        return &_aligned_cast_short_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_int :
                                    &_contig_cast_short_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_int :
                                         &_cast_short_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_short_to_long;
                    }
                    else {
                        return &_aligned_cast_short_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_long :
                                    &_contig_cast_short_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_long :
                                         &_cast_short_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_short_to_longlong;
                    }
                    else {
                        return &_aligned_cast_short_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_longlong :
                                    &_contig_cast_short_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_longlong :
                                         &_cast_short_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_short_to_half;
                    }
                    else {
                        return &_aligned_cast_short_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_half :
                                    &_contig_cast_short_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_half :
                                         &_cast_short_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_short_to_float;
                    }
                    else {
                        return &_aligned_cast_short_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_float :
                                    &_contig_cast_short_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_float :
                                         &_cast_short_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_short_to_double;
                    }
                    else {
                        return &_aligned_cast_short_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_double :
                                    &_contig_cast_short_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_double :
                                         &_cast_short_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_short_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_short_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_longdouble :
                                    &_contig_cast_short_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_longdouble :
                                         &_cast_short_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_short_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_short_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_cfloat :
                                    &_contig_cast_short_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_cfloat :
                                         &_cast_short_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_short_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_short_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_cdouble :
                                    &_contig_cast_short_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_cdouble :
                                         &_cast_short_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_SHORT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_short_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_short_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_short) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_short_to_clongdouble :
                                    &_contig_cast_short_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_short_to_clongdouble :
                                         &_cast_short_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_SHORT, dst_type_num);*/


#line 966

        case NPY_INT:
            /*printf("test fn %d - second %d\n", NPY_INT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_int_to_bool;
                    }
                    else {
                        return &_aligned_cast_int_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_bool :
                                    &_contig_cast_int_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_bool :
                                         &_cast_int_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_int_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_int_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_ubyte :
                                    &_contig_cast_int_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_ubyte :
                                         &_cast_int_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_int_to_ushort;
                    }
                    else {
                        return &_aligned_cast_int_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_ushort :
                                    &_contig_cast_int_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_ushort :
                                         &_cast_int_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_int_to_uint;
                    }
                    else {
                        return &_aligned_cast_int_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_uint :
                                    &_contig_cast_int_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_uint :
                                         &_cast_int_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_int_to_ulong;
                    }
                    else {
                        return &_aligned_cast_int_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_ulong :
                                    &_contig_cast_int_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_ulong :
                                         &_cast_int_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_int_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_int_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_ulonglong :
                                    &_contig_cast_int_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_ulonglong :
                                         &_cast_int_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_int_to_byte;
                    }
                    else {
                        return &_aligned_cast_int_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_byte :
                                    &_contig_cast_int_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_byte :
                                         &_cast_int_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_int_to_short;
                    }
                    else {
                        return &_aligned_cast_int_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_short :
                                    &_contig_cast_int_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_short :
                                         &_cast_int_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_int_to_int;
                    }
                    else {
                        return &_aligned_cast_int_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_int :
                                    &_contig_cast_int_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_int :
                                         &_cast_int_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_int_to_long;
                    }
                    else {
                        return &_aligned_cast_int_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_long :
                                    &_contig_cast_int_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_long :
                                         &_cast_int_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_int_to_longlong;
                    }
                    else {
                        return &_aligned_cast_int_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_longlong :
                                    &_contig_cast_int_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_longlong :
                                         &_cast_int_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_int_to_half;
                    }
                    else {
                        return &_aligned_cast_int_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_half :
                                    &_contig_cast_int_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_half :
                                         &_cast_int_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_int_to_float;
                    }
                    else {
                        return &_aligned_cast_int_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_float :
                                    &_contig_cast_int_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_float :
                                         &_cast_int_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_int_to_double;
                    }
                    else {
                        return &_aligned_cast_int_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_double :
                                    &_contig_cast_int_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_double :
                                         &_cast_int_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_int_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_int_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_longdouble :
                                    &_contig_cast_int_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_longdouble :
                                         &_cast_int_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_int_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_int_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_cfloat :
                                    &_contig_cast_int_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_cfloat :
                                         &_cast_int_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_int_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_int_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_cdouble :
                                    &_contig_cast_int_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_cdouble :
                                         &_cast_int_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_INT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_int_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_int_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_int) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_int_to_clongdouble :
                                    &_contig_cast_int_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_int_to_clongdouble :
                                         &_cast_int_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_INT, dst_type_num);*/


#line 966

        case NPY_LONG:
            /*printf("test fn %d - second %d\n", NPY_LONG, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_long_to_bool;
                    }
                    else {
                        return &_aligned_cast_long_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_bool :
                                    &_contig_cast_long_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_bool :
                                         &_cast_long_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_long_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_long_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_ubyte :
                                    &_contig_cast_long_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_ubyte :
                                         &_cast_long_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_long_to_ushort;
                    }
                    else {
                        return &_aligned_cast_long_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_ushort :
                                    &_contig_cast_long_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_ushort :
                                         &_cast_long_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_long_to_uint;
                    }
                    else {
                        return &_aligned_cast_long_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_uint :
                                    &_contig_cast_long_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_uint :
                                         &_cast_long_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_long_to_ulong;
                    }
                    else {
                        return &_aligned_cast_long_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_ulong :
                                    &_contig_cast_long_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_ulong :
                                         &_cast_long_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_long_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_long_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_ulonglong :
                                    &_contig_cast_long_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_ulonglong :
                                         &_cast_long_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_long_to_byte;
                    }
                    else {
                        return &_aligned_cast_long_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_byte :
                                    &_contig_cast_long_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_byte :
                                         &_cast_long_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_long_to_short;
                    }
                    else {
                        return &_aligned_cast_long_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_short :
                                    &_contig_cast_long_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_short :
                                         &_cast_long_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_long_to_int;
                    }
                    else {
                        return &_aligned_cast_long_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_int :
                                    &_contig_cast_long_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_int :
                                         &_cast_long_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_long_to_long;
                    }
                    else {
                        return &_aligned_cast_long_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_long :
                                    &_contig_cast_long_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_long :
                                         &_cast_long_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_long_to_longlong;
                    }
                    else {
                        return &_aligned_cast_long_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_longlong :
                                    &_contig_cast_long_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_longlong :
                                         &_cast_long_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_long_to_half;
                    }
                    else {
                        return &_aligned_cast_long_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_half :
                                    &_contig_cast_long_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_half :
                                         &_cast_long_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_long_to_float;
                    }
                    else {
                        return &_aligned_cast_long_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_float :
                                    &_contig_cast_long_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_float :
                                         &_cast_long_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_long_to_double;
                    }
                    else {
                        return &_aligned_cast_long_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_double :
                                    &_contig_cast_long_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_double :
                                         &_cast_long_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_long_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_long_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_longdouble :
                                    &_contig_cast_long_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_longdouble :
                                         &_cast_long_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_long_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_long_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_cfloat :
                                    &_contig_cast_long_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_cfloat :
                                         &_cast_long_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_long_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_long_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_cdouble :
                                    &_contig_cast_long_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_cdouble :
                                         &_cast_long_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONG, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_long_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_long_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_long) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_long_to_clongdouble :
                                    &_contig_cast_long_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_long_to_clongdouble :
                                         &_cast_long_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_LONG, dst_type_num);*/


#line 966

        case NPY_LONGLONG:
            /*printf("test fn %d - second %d\n", NPY_LONGLONG, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_longlong_to_bool;
                    }
                    else {
                        return &_aligned_cast_longlong_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_bool :
                                    &_contig_cast_longlong_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_bool :
                                         &_cast_longlong_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_longlong_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_longlong_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_ubyte :
                                    &_contig_cast_longlong_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_ubyte :
                                         &_cast_longlong_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_longlong_to_ushort;
                    }
                    else {
                        return &_aligned_cast_longlong_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_ushort :
                                    &_contig_cast_longlong_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_ushort :
                                         &_cast_longlong_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_longlong_to_uint;
                    }
                    else {
                        return &_aligned_cast_longlong_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_uint :
                                    &_contig_cast_longlong_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_uint :
                                         &_cast_longlong_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_longlong_to_ulong;
                    }
                    else {
                        return &_aligned_cast_longlong_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_ulong :
                                    &_contig_cast_longlong_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_ulong :
                                         &_cast_longlong_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_longlong_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_longlong_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_ulonglong :
                                    &_contig_cast_longlong_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_ulonglong :
                                         &_cast_longlong_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_longlong_to_byte;
                    }
                    else {
                        return &_aligned_cast_longlong_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_byte :
                                    &_contig_cast_longlong_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_byte :
                                         &_cast_longlong_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_longlong_to_short;
                    }
                    else {
                        return &_aligned_cast_longlong_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_short :
                                    &_contig_cast_longlong_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_short :
                                         &_cast_longlong_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_longlong_to_int;
                    }
                    else {
                        return &_aligned_cast_longlong_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_int :
                                    &_contig_cast_longlong_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_int :
                                         &_cast_longlong_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_longlong_to_long;
                    }
                    else {
                        return &_aligned_cast_longlong_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_long :
                                    &_contig_cast_longlong_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_long :
                                         &_cast_longlong_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_longlong_to_longlong;
                    }
                    else {
                        return &_aligned_cast_longlong_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_longlong :
                                    &_contig_cast_longlong_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_longlong :
                                         &_cast_longlong_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_longlong_to_half;
                    }
                    else {
                        return &_aligned_cast_longlong_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_half :
                                    &_contig_cast_longlong_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_half :
                                         &_cast_longlong_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_longlong_to_float;
                    }
                    else {
                        return &_aligned_cast_longlong_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_float :
                                    &_contig_cast_longlong_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_float :
                                         &_cast_longlong_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_longlong_to_double;
                    }
                    else {
                        return &_aligned_cast_longlong_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_double :
                                    &_contig_cast_longlong_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_double :
                                         &_cast_longlong_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_longlong_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_longlong_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_longdouble :
                                    &_contig_cast_longlong_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_longdouble :
                                         &_cast_longlong_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_longlong_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_longlong_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_cfloat :
                                    &_contig_cast_longlong_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_cfloat :
                                         &_cast_longlong_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_longlong_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_longlong_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_cdouble :
                                    &_contig_cast_longlong_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_cdouble :
                                         &_cast_longlong_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGLONG, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_longlong_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_longlong_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longlong) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longlong_to_clongdouble :
                                    &_contig_cast_longlong_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longlong_to_clongdouble :
                                         &_cast_longlong_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_LONGLONG, dst_type_num);*/


#line 966

        case NPY_HALF:
            /*printf("test fn %d - second %d\n", NPY_HALF, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_half_to_bool;
                    }
                    else {
                        return &_aligned_cast_half_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_bool :
                                    &_contig_cast_half_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_bool :
                                         &_cast_half_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_half_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_half_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_ubyte :
                                    &_contig_cast_half_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_ubyte :
                                         &_cast_half_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_half_to_ushort;
                    }
                    else {
                        return &_aligned_cast_half_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_ushort :
                                    &_contig_cast_half_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_ushort :
                                         &_cast_half_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_half_to_uint;
                    }
                    else {
                        return &_aligned_cast_half_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_uint :
                                    &_contig_cast_half_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_uint :
                                         &_cast_half_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_half_to_ulong;
                    }
                    else {
                        return &_aligned_cast_half_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_ulong :
                                    &_contig_cast_half_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_ulong :
                                         &_cast_half_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_half_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_half_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_ulonglong :
                                    &_contig_cast_half_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_ulonglong :
                                         &_cast_half_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_half_to_byte;
                    }
                    else {
                        return &_aligned_cast_half_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_byte :
                                    &_contig_cast_half_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_byte :
                                         &_cast_half_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_half_to_short;
                    }
                    else {
                        return &_aligned_cast_half_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_short :
                                    &_contig_cast_half_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_short :
                                         &_cast_half_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_half_to_int;
                    }
                    else {
                        return &_aligned_cast_half_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_int :
                                    &_contig_cast_half_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_int :
                                         &_cast_half_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_half_to_long;
                    }
                    else {
                        return &_aligned_cast_half_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_long :
                                    &_contig_cast_half_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_long :
                                         &_cast_half_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_half_to_longlong;
                    }
                    else {
                        return &_aligned_cast_half_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_longlong :
                                    &_contig_cast_half_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_longlong :
                                         &_cast_half_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_half_to_half;
                    }
                    else {
                        return &_aligned_cast_half_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_half :
                                    &_contig_cast_half_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_half :
                                         &_cast_half_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_half_to_float;
                    }
                    else {
                        return &_aligned_cast_half_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_float :
                                    &_contig_cast_half_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_float :
                                         &_cast_half_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_half_to_double;
                    }
                    else {
                        return &_aligned_cast_half_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_double :
                                    &_contig_cast_half_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_double :
                                         &_cast_half_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_half_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_half_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_longdouble :
                                    &_contig_cast_half_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_longdouble :
                                         &_cast_half_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_half_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_half_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_cfloat :
                                    &_contig_cast_half_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_cfloat :
                                         &_cast_half_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_half_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_half_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_cdouble :
                                    &_contig_cast_half_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_cdouble :
                                         &_cast_half_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_HALF, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_half_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_half_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_half) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_half_to_clongdouble :
                                    &_contig_cast_half_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_half_to_clongdouble :
                                         &_cast_half_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_HALF, dst_type_num);*/


#line 966

        case NPY_FLOAT:
            /*printf("test fn %d - second %d\n", NPY_FLOAT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_float_to_bool;
                    }
                    else {
                        return &_aligned_cast_float_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_bool :
                                    &_contig_cast_float_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_bool :
                                         &_cast_float_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_float_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_float_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_ubyte :
                                    &_contig_cast_float_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_ubyte :
                                         &_cast_float_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_float_to_ushort;
                    }
                    else {
                        return &_aligned_cast_float_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_ushort :
                                    &_contig_cast_float_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_ushort :
                                         &_cast_float_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_float_to_uint;
                    }
                    else {
                        return &_aligned_cast_float_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_uint :
                                    &_contig_cast_float_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_uint :
                                         &_cast_float_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_float_to_ulong;
                    }
                    else {
                        return &_aligned_cast_float_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_ulong :
                                    &_contig_cast_float_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_ulong :
                                         &_cast_float_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_float_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_float_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_ulonglong :
                                    &_contig_cast_float_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_ulonglong :
                                         &_cast_float_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_float_to_byte;
                    }
                    else {
                        return &_aligned_cast_float_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_byte :
                                    &_contig_cast_float_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_byte :
                                         &_cast_float_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_float_to_short;
                    }
                    else {
                        return &_aligned_cast_float_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_short :
                                    &_contig_cast_float_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_short :
                                         &_cast_float_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_float_to_int;
                    }
                    else {
                        return &_aligned_cast_float_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_int :
                                    &_contig_cast_float_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_int :
                                         &_cast_float_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_float_to_long;
                    }
                    else {
                        return &_aligned_cast_float_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_long :
                                    &_contig_cast_float_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_long :
                                         &_cast_float_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_float_to_longlong;
                    }
                    else {
                        return &_aligned_cast_float_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_longlong :
                                    &_contig_cast_float_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_longlong :
                                         &_cast_float_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_float_to_half;
                    }
                    else {
                        return &_aligned_cast_float_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_half :
                                    &_contig_cast_float_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_half :
                                         &_cast_float_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_float_to_float;
                    }
                    else {
                        return &_aligned_cast_float_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_float :
                                    &_contig_cast_float_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_float :
                                         &_cast_float_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_float_to_double;
                    }
                    else {
                        return &_aligned_cast_float_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_double :
                                    &_contig_cast_float_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_double :
                                         &_cast_float_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_float_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_float_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_longdouble :
                                    &_contig_cast_float_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_longdouble :
                                         &_cast_float_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_float_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_float_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_cfloat :
                                    &_contig_cast_float_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_cfloat :
                                         &_cast_float_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_float_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_float_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_cdouble :
                                    &_contig_cast_float_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_cdouble :
                                         &_cast_float_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_FLOAT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_float_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_float_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_float) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_float_to_clongdouble :
                                    &_contig_cast_float_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_float_to_clongdouble :
                                         &_cast_float_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_FLOAT, dst_type_num);*/


#line 966

        case NPY_DOUBLE:
            /*printf("test fn %d - second %d\n", NPY_DOUBLE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_double_to_bool;
                    }
                    else {
                        return &_aligned_cast_double_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_bool :
                                    &_contig_cast_double_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_bool :
                                         &_cast_double_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_double_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_double_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_ubyte :
                                    &_contig_cast_double_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_ubyte :
                                         &_cast_double_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_double_to_ushort;
                    }
                    else {
                        return &_aligned_cast_double_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_ushort :
                                    &_contig_cast_double_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_ushort :
                                         &_cast_double_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_double_to_uint;
                    }
                    else {
                        return &_aligned_cast_double_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_uint :
                                    &_contig_cast_double_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_uint :
                                         &_cast_double_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_double_to_ulong;
                    }
                    else {
                        return &_aligned_cast_double_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_ulong :
                                    &_contig_cast_double_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_ulong :
                                         &_cast_double_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_double_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_double_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_ulonglong :
                                    &_contig_cast_double_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_ulonglong :
                                         &_cast_double_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_double_to_byte;
                    }
                    else {
                        return &_aligned_cast_double_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_byte :
                                    &_contig_cast_double_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_byte :
                                         &_cast_double_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_double_to_short;
                    }
                    else {
                        return &_aligned_cast_double_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_short :
                                    &_contig_cast_double_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_short :
                                         &_cast_double_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_double_to_int;
                    }
                    else {
                        return &_aligned_cast_double_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_int :
                                    &_contig_cast_double_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_int :
                                         &_cast_double_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_double_to_long;
                    }
                    else {
                        return &_aligned_cast_double_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_long :
                                    &_contig_cast_double_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_long :
                                         &_cast_double_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_double_to_longlong;
                    }
                    else {
                        return &_aligned_cast_double_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_longlong :
                                    &_contig_cast_double_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_longlong :
                                         &_cast_double_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_double_to_half;
                    }
                    else {
                        return &_aligned_cast_double_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_half :
                                    &_contig_cast_double_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_half :
                                         &_cast_double_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_double_to_float;
                    }
                    else {
                        return &_aligned_cast_double_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_float :
                                    &_contig_cast_double_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_float :
                                         &_cast_double_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_double_to_double;
                    }
                    else {
                        return &_aligned_cast_double_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_double :
                                    &_contig_cast_double_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_double :
                                         &_cast_double_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_double_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_double_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_longdouble :
                                    &_contig_cast_double_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_longdouble :
                                         &_cast_double_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_double_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_double_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_cfloat :
                                    &_contig_cast_double_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_cfloat :
                                         &_cast_double_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_double_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_double_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_cdouble :
                                    &_contig_cast_double_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_cdouble :
                                         &_cast_double_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_DOUBLE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_double_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_double_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_double) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_double_to_clongdouble :
                                    &_contig_cast_double_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_double_to_clongdouble :
                                         &_cast_double_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_DOUBLE, dst_type_num);*/


#line 966

        case NPY_LONGDOUBLE:
            /*printf("test fn %d - second %d\n", NPY_LONGDOUBLE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_longdouble_to_bool;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_bool :
                                    &_contig_cast_longdouble_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_bool :
                                         &_cast_longdouble_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_longdouble_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_ubyte :
                                    &_contig_cast_longdouble_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_ubyte :
                                         &_cast_longdouble_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_longdouble_to_ushort;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_ushort :
                                    &_contig_cast_longdouble_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_ushort :
                                         &_cast_longdouble_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_longdouble_to_uint;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_uint :
                                    &_contig_cast_longdouble_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_uint :
                                         &_cast_longdouble_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_longdouble_to_ulong;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_ulong :
                                    &_contig_cast_longdouble_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_ulong :
                                         &_cast_longdouble_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_longdouble_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_ulonglong :
                                    &_contig_cast_longdouble_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_ulonglong :
                                         &_cast_longdouble_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_longdouble_to_byte;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_byte :
                                    &_contig_cast_longdouble_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_byte :
                                         &_cast_longdouble_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_longdouble_to_short;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_short :
                                    &_contig_cast_longdouble_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_short :
                                         &_cast_longdouble_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_longdouble_to_int;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_int :
                                    &_contig_cast_longdouble_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_int :
                                         &_cast_longdouble_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_longdouble_to_long;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_long :
                                    &_contig_cast_longdouble_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_long :
                                         &_cast_longdouble_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_longdouble_to_longlong;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_longlong :
                                    &_contig_cast_longdouble_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_longlong :
                                         &_cast_longdouble_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_longdouble_to_half;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_half :
                                    &_contig_cast_longdouble_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_half :
                                         &_cast_longdouble_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_longdouble_to_float;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_float :
                                    &_contig_cast_longdouble_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_float :
                                         &_cast_longdouble_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_longdouble_to_double;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_double :
                                    &_contig_cast_longdouble_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_double :
                                         &_cast_longdouble_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_longdouble_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_longdouble :
                                    &_contig_cast_longdouble_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_longdouble :
                                         &_cast_longdouble_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_longdouble_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_cfloat :
                                    &_contig_cast_longdouble_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_cfloat :
                                         &_cast_longdouble_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_longdouble_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_cdouble :
                                    &_contig_cast_longdouble_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_cdouble :
                                         &_cast_longdouble_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_LONGDOUBLE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_longdouble_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_longdouble_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_longdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_longdouble_to_clongdouble :
                                    &_contig_cast_longdouble_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_longdouble_to_clongdouble :
                                         &_cast_longdouble_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_LONGDOUBLE, dst_type_num);*/


#line 966

        case NPY_CFLOAT:
            /*printf("test fn %d - second %d\n", NPY_CFLOAT, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_cfloat_to_bool;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_bool :
                                    &_contig_cast_cfloat_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_bool :
                                         &_cast_cfloat_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_cfloat_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_ubyte :
                                    &_contig_cast_cfloat_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_ubyte :
                                         &_cast_cfloat_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_cfloat_to_ushort;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_ushort :
                                    &_contig_cast_cfloat_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_ushort :
                                         &_cast_cfloat_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_cfloat_to_uint;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_uint :
                                    &_contig_cast_cfloat_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_uint :
                                         &_cast_cfloat_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_cfloat_to_ulong;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_ulong :
                                    &_contig_cast_cfloat_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_ulong :
                                         &_cast_cfloat_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_cfloat_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_ulonglong :
                                    &_contig_cast_cfloat_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_ulonglong :
                                         &_cast_cfloat_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_cfloat_to_byte;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_byte :
                                    &_contig_cast_cfloat_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_byte :
                                         &_cast_cfloat_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_cfloat_to_short;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_short :
                                    &_contig_cast_cfloat_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_short :
                                         &_cast_cfloat_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_cfloat_to_int;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_int :
                                    &_contig_cast_cfloat_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_int :
                                         &_cast_cfloat_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_cfloat_to_long;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_long :
                                    &_contig_cast_cfloat_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_long :
                                         &_cast_cfloat_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_cfloat_to_longlong;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_longlong :
                                    &_contig_cast_cfloat_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_longlong :
                                         &_cast_cfloat_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_cfloat_to_half;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_half :
                                    &_contig_cast_cfloat_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_half :
                                         &_cast_cfloat_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_cfloat_to_float;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_float :
                                    &_contig_cast_cfloat_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_float :
                                         &_cast_cfloat_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_cfloat_to_double;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_double :
                                    &_contig_cast_cfloat_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_double :
                                         &_cast_cfloat_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_cfloat_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_longdouble :
                                    &_contig_cast_cfloat_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_longdouble :
                                         &_cast_cfloat_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_cfloat_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_cfloat :
                                    &_contig_cast_cfloat_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_cfloat :
                                         &_cast_cfloat_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_cfloat_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_cdouble :
                                    &_contig_cast_cfloat_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_cdouble :
                                         &_cast_cfloat_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CFLOAT, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_cfloat_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_cfloat_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cfloat) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cfloat_to_clongdouble :
                                    &_contig_cast_cfloat_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cfloat_to_clongdouble :
                                         &_cast_cfloat_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_CFLOAT, dst_type_num);*/


#line 966

        case NPY_CDOUBLE:
            /*printf("test fn %d - second %d\n", NPY_CDOUBLE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_cdouble_to_bool;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_bool :
                                    &_contig_cast_cdouble_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_bool :
                                         &_cast_cdouble_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_cdouble_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_ubyte :
                                    &_contig_cast_cdouble_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_ubyte :
                                         &_cast_cdouble_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_cdouble_to_ushort;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_ushort :
                                    &_contig_cast_cdouble_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_ushort :
                                         &_cast_cdouble_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_cdouble_to_uint;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_uint :
                                    &_contig_cast_cdouble_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_uint :
                                         &_cast_cdouble_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_cdouble_to_ulong;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_ulong :
                                    &_contig_cast_cdouble_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_ulong :
                                         &_cast_cdouble_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_cdouble_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_ulonglong :
                                    &_contig_cast_cdouble_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_ulonglong :
                                         &_cast_cdouble_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_cdouble_to_byte;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_byte :
                                    &_contig_cast_cdouble_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_byte :
                                         &_cast_cdouble_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_cdouble_to_short;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_short :
                                    &_contig_cast_cdouble_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_short :
                                         &_cast_cdouble_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_cdouble_to_int;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_int :
                                    &_contig_cast_cdouble_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_int :
                                         &_cast_cdouble_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_cdouble_to_long;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_long :
                                    &_contig_cast_cdouble_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_long :
                                         &_cast_cdouble_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_cdouble_to_longlong;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_longlong :
                                    &_contig_cast_cdouble_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_longlong :
                                         &_cast_cdouble_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_cdouble_to_half;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_half :
                                    &_contig_cast_cdouble_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_half :
                                         &_cast_cdouble_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_cdouble_to_float;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_float :
                                    &_contig_cast_cdouble_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_float :
                                         &_cast_cdouble_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_cdouble_to_double;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_double :
                                    &_contig_cast_cdouble_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_double :
                                         &_cast_cdouble_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_cdouble_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_longdouble :
                                    &_contig_cast_cdouble_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_longdouble :
                                         &_cast_cdouble_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_cdouble_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_cfloat :
                                    &_contig_cast_cdouble_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_cfloat :
                                         &_cast_cdouble_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_cdouble_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_cdouble :
                                    &_contig_cast_cdouble_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_cdouble :
                                         &_cast_cdouble_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CDOUBLE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_cdouble_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_cdouble_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_cdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_cdouble_to_clongdouble :
                                    &_contig_cast_cdouble_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_cdouble_to_clongdouble :
                                         &_cast_cdouble_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_CDOUBLE, dst_type_num);*/


#line 966

        case NPY_CLONGDOUBLE:
            /*printf("test fn %d - second %d\n", NPY_CLONGDOUBLE, dst_type_num);*/
            switch (dst_type_num) {
#line 988

                case NPY_BOOL:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_BOOL);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return &_aligned_contig_cast_clongdouble_to_bool;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_bool;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_bool)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_bool :
                                    &_contig_cast_clongdouble_to_bool;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_bool :
                                         &_cast_clongdouble_to_bool;
                    }
#  endif


#line 988

                case NPY_UBYTE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_UBYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return &_aligned_contig_cast_clongdouble_to_ubyte;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_ubyte;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ubyte)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_ubyte :
                                    &_contig_cast_clongdouble_to_ubyte;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_ubyte :
                                         &_cast_clongdouble_to_ubyte;
                    }
#  endif


#line 988

                case NPY_USHORT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_USHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return &_aligned_contig_cast_clongdouble_to_ushort;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_ushort;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ushort)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_ushort :
                                    &_contig_cast_clongdouble_to_ushort;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_ushort :
                                         &_cast_clongdouble_to_ushort;
                    }
#  endif


#line 988

                case NPY_UINT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_UINT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return &_aligned_contig_cast_clongdouble_to_uint;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_uint;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_uint)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_uint :
                                    &_contig_cast_clongdouble_to_uint;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_uint :
                                         &_cast_clongdouble_to_uint;
                    }
#  endif


#line 988

                case NPY_ULONG:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_ULONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return &_aligned_contig_cast_clongdouble_to_ulong;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_ulong;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ulong)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_ulong :
                                    &_contig_cast_clongdouble_to_ulong;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_ulong :
                                         &_cast_clongdouble_to_ulong;
                    }
#  endif


#line 988

                case NPY_ULONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_ULONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return &_aligned_contig_cast_clongdouble_to_ulonglong;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_ulonglong;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_ulonglong)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_ulonglong :
                                    &_contig_cast_clongdouble_to_ulonglong;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_ulonglong :
                                         &_cast_clongdouble_to_ulonglong;
                    }
#  endif


#line 988

                case NPY_BYTE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_BYTE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return &_aligned_contig_cast_clongdouble_to_byte;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_byte;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_byte)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_byte :
                                    &_contig_cast_clongdouble_to_byte;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_byte :
                                         &_cast_clongdouble_to_byte;
                    }
#  endif


#line 988

                case NPY_SHORT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_SHORT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return &_aligned_contig_cast_clongdouble_to_short;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_short;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_short)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_short :
                                    &_contig_cast_clongdouble_to_short;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_short :
                                         &_cast_clongdouble_to_short;
                    }
#  endif


#line 988

                case NPY_INT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_INT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return &_aligned_contig_cast_clongdouble_to_int;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_int;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_int)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_int :
                                    &_contig_cast_clongdouble_to_int;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_int :
                                         &_cast_clongdouble_to_int;
                    }
#  endif


#line 988

                case NPY_LONG:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_LONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return &_aligned_contig_cast_clongdouble_to_long;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_long;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_long)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_long :
                                    &_contig_cast_clongdouble_to_long;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_long :
                                         &_cast_clongdouble_to_long;
                    }
#  endif


#line 988

                case NPY_LONGLONG:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_LONGLONG);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return &_aligned_contig_cast_clongdouble_to_longlong;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_longlong;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_longlong)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_longlong :
                                    &_contig_cast_clongdouble_to_longlong;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_longlong :
                                         &_cast_clongdouble_to_longlong;
                    }
#  endif


#line 988

                case NPY_HALF:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_HALF);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return &_aligned_contig_cast_clongdouble_to_half;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_half;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_half)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_half :
                                    &_contig_cast_clongdouble_to_half;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_half :
                                         &_cast_clongdouble_to_half;
                    }
#  endif


#line 988

                case NPY_FLOAT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_FLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return &_aligned_contig_cast_clongdouble_to_float;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_float;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_float)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_float :
                                    &_contig_cast_clongdouble_to_float;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_float :
                                         &_cast_clongdouble_to_float;
                    }
#  endif


#line 988

                case NPY_DOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_DOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return &_aligned_contig_cast_clongdouble_to_double;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_double;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_double)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_double :
                                    &_contig_cast_clongdouble_to_double;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_double :
                                         &_cast_clongdouble_to_double;
                    }
#  endif


#line 988

                case NPY_LONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_LONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return &_aligned_contig_cast_clongdouble_to_longdouble;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_longdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_longdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_longdouble :
                                    &_contig_cast_clongdouble_to_longdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_longdouble :
                                         &_cast_clongdouble_to_longdouble;
                    }
#  endif


#line 988

                case NPY_CFLOAT:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_CFLOAT);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return &_aligned_contig_cast_clongdouble_to_cfloat;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_cfloat;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_cfloat)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_cfloat :
                                    &_contig_cast_clongdouble_to_cfloat;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_cfloat :
                                         &_cast_clongdouble_to_cfloat;
                    }
#  endif


#line 988

                case NPY_CDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_CDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return &_aligned_contig_cast_clongdouble_to_cdouble;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_cdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_cdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_cdouble :
                                    &_contig_cast_clongdouble_to_cdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_cdouble :
                                         &_cast_clongdouble_to_cdouble;
                    }
#  endif


#line 988

                case NPY_CLONGDOUBLE:
                    /*printf("ret fn %d %d\n", NPY_CLONGDOUBLE, NPY_CLONGDOUBLE);*/
#  if NPY_USE_UNALIGNED_ACCESS
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return &_aligned_contig_cast_clongdouble_to_clongdouble;
                    }
                    else {
                        return &_aligned_cast_clongdouble_to_clongdouble;
                    }
#  else
                    if (src_stride == sizeof(npy_clongdouble) &&
                                dst_stride == sizeof(npy_clongdouble)) {
                        return aligned ?
                                    &_aligned_contig_cast_clongdouble_to_clongdouble :
                                    &_contig_cast_clongdouble_to_clongdouble;
                    }
                    else {
                        return aligned ? &_aligned_cast_clongdouble_to_clongdouble :
                                         &_cast_clongdouble_to_clongdouble;
                    }
#  endif


            }
            /*printf("switched test fn %d - second %d\n", NPY_CLONGDOUBLE, dst_type_num);*/


    }

    return NULL;
}


/****************** PRIMITIVE FLAT TO/FROM NDIM FUNCTIONS ******************/

/* See documentation of arguments in lowlevel_strided_loops.h */
NPY_NO_EXPORT npy_intp
PyArray_TransferNDimToStrided(npy_intp ndim,
                char *dst, npy_intp dst_stride,
                char *src, npy_intp const *src_strides, npy_intp src_strides_inc,
                npy_intp const *coords, npy_intp coords_inc,
                npy_intp const *shape, npy_intp shape_inc,
                npy_intp count, npy_intp src_itemsize,
                NPY_cast_info *cast_info)
{
    npy_intp i, M, N, coord0, shape0, src_stride0, coord1, shape1, src_stride1;

    /* Finish off dimension 0 */
    coord0 = coords[0];
    shape0 = shape[0];
    src_stride0 = src_strides[0];
    N = shape0 - coord0;

    npy_intp strides[2] = {src_stride0, dst_stride};

    char *args[2] = {src, dst};
    if (N >= count) {
        return cast_info->func(&cast_info->context,
                args, &count, strides, cast_info->auxdata);
    }
    int res = cast_info->func(&cast_info->context,
            args, &N, strides, cast_info->auxdata);

    if (res < 0) {
        return -1;
    }
    count -= N;

    /* If it's 1-dimensional, there's no more to copy */
    if (ndim == 1) {
        return count;
    }

    /* Adjust the src and dst pointers */
    coord1 = (coords + coords_inc)[0];
    shape1 = (shape + shape_inc)[0];
    src_stride1 = (src_strides + src_strides_inc)[0];
    src = src - coord0*src_stride0 + src_stride1;
    dst += N*dst_stride;

    /* Finish off dimension 1 */
    M = (shape1 - coord1 - 1);
    N = shape0*M;
    for (i = 0; i < M; ++i) {
        args[0] = src; args[1] = dst;
        if (shape0 >= count) {
            return cast_info->func(&cast_info->context,
                    args, &count, strides, cast_info->auxdata);
        }
        else {
            res = cast_info->func(&cast_info->context,
                    args, &shape0, strides, cast_info->auxdata);
            if (res < 0) {
                return -1;
            }
        }
        count -= shape0;
        src += src_stride1;
        dst += shape0*dst_stride;
    }

    /* If it's 2-dimensional, there's no more to copy */
    if (ndim == 2) {
        return count;
    }

    /* General-case loop for everything else */
    else {
        /* Iteration structure for dimensions 2 and up */
        struct {
            npy_intp coord, shape, src_stride;
        } it[NPY_MAXDIMS];

        /* Copy the coordinates and shape */
        coords += 2*coords_inc;
        shape += 2*shape_inc;
        src_strides += 2*src_strides_inc;
        for (i = 0; i < ndim-2; ++i) {
            it[i].coord = coords[0];
            it[i].shape = shape[0];
            it[i].src_stride = src_strides[0];
            coords += coords_inc;
            shape += shape_inc;
            src_strides += src_strides_inc;
        }

        for (;;) {
            /* Adjust the src pointer from the dimension 0 and 1 loop */
            src = src - shape1*src_stride1;

            /* Increment to the next coordinate */
            for (i = 0; i < ndim-2; ++i) {
                src += it[i].src_stride;
                if (++it[i].coord >= it[i].shape) {
                    it[i].coord = 0;
                    src -= it[i].src_stride*it[i].shape;
                }
                else {
                    break;
                }
            }
            /* If the last dimension rolled over, we're done */
            if (i == ndim-2) {
                return count;
            }

            /* A loop for dimensions 0 and 1 */
            for (i = 0; i < shape1; ++i) {
                args[0] = src; args[1] = dst;
                if (shape0 >= count) {
                    return cast_info->func(&cast_info->context,
                            args, &count, strides, cast_info->auxdata);
                }
                else {
                    res = cast_info->func(&cast_info->context,
                            args, &shape0, strides, cast_info->auxdata);
                    if (res < 0) {
                        return -1;
                    }
                }
                count -= shape0;
                src += src_stride1;
                dst += shape0*dst_stride;
            }
        }
    }
}

/* See documentation of arguments in lowlevel_strided_loops.h */
NPY_NO_EXPORT npy_intp
PyArray_TransferStridedToNDim(npy_intp ndim,
                char *dst, npy_intp const *dst_strides, npy_intp dst_strides_inc,
                char *src, npy_intp src_stride,
                npy_intp const *coords, npy_intp coords_inc,
                npy_intp const *shape, npy_intp shape_inc,
                npy_intp count, npy_intp src_itemsize,
                NPY_cast_info *cast_info)
{
    npy_intp i, M, N, coord0, shape0, dst_stride0, coord1, shape1, dst_stride1;

    /* Finish off dimension 0 */
    coord0 = coords[0];
    shape0 = shape[0];
    dst_stride0 = dst_strides[0];
    N = shape0 - coord0;

    npy_intp strides[2] = {src_stride, dst_stride0};

    char *args[2] = {src, dst};
    if (N >= count) {
        return cast_info->func(&cast_info->context,
                args, &count, strides, cast_info->auxdata);
    }
    int res = cast_info->func(&cast_info->context,
            args, &N, strides, cast_info->auxdata);
    if (res < 0) {
        return -1;
    }
    count -= N;

    /* If it's 1-dimensional, there's no more to copy */
    if (ndim == 1) {
        return count;
    }

    /* Adjust the src and dst pointers */
    coord1 = (coords + coords_inc)[0];
    shape1 = (shape + shape_inc)[0];
    dst_stride1 = (dst_strides + dst_strides_inc)[0];
    dst = dst - coord0*dst_stride0 + dst_stride1;
    src += N*src_stride;

    /* Finish off dimension 1 */
    M = (shape1 - coord1 - 1);
    N = shape0*M;
    for (i = 0; i < M; ++i) {
        args[0] = src; args[1] = dst;
        if (shape0 >= count) {
            return cast_info->func(&cast_info->context,
                    args, &count, strides, cast_info->auxdata);
        }
        else {
            res = cast_info->func(&cast_info->context,
                    args, &shape0, strides, cast_info->auxdata);
            if (res < 0) {
                return -1;
            }
        }
        count -= shape0;
        dst += dst_stride1;
        src += shape0*src_stride;
    }

    /* If it's 2-dimensional, there's no more to copy */
    if (ndim == 2) {
        return count;
    }

    /* General-case loop for everything else */
    else {
        /* Iteration structure for dimensions 2 and up */
        struct {
            npy_intp coord, shape, dst_stride;
        } it[NPY_MAXDIMS];

        /* Copy the coordinates and shape */
        coords += 2*coords_inc;
        shape += 2*shape_inc;
        dst_strides += 2*dst_strides_inc;
        for (i = 0; i < ndim-2; ++i) {
            it[i].coord = coords[0];
            it[i].shape = shape[0];
            it[i].dst_stride = dst_strides[0];
            coords += coords_inc;
            shape += shape_inc;
            dst_strides += dst_strides_inc;
        }

        for (;;) {
            /* Adjust the dst pointer from the dimension 0 and 1 loop */
            dst = dst - shape1*dst_stride1;

            /* Increment to the next coordinate */
            for (i = 0; i < ndim-2; ++i) {
                dst += it[i].dst_stride;
                if (++it[i].coord >= it[i].shape) {
                    it[i].coord = 0;
                    dst -= it[i].dst_stride*it[i].shape;
                }
                else {
                    break;
                }
            }
            /* If the last dimension rolled over, we're done */
            if (i == ndim-2) {
                return count;
            }

            /* A loop for dimensions 0 and 1 */
            for (i = 0; i < shape1; ++i) {
                args[0] = src; args[1] = dst;
                if (shape0 >= count) {
                    return cast_info->func(&cast_info->context,
                            args, &count, strides, cast_info->auxdata);
                }
                else {
                    res = cast_info->func(&cast_info->context,
                            args, &shape0, strides, cast_info->auxdata);
                    if (res < 0) {
                        return -1;
                    }
                }
                count -= shape0;
                dst += dst_stride1;
                src += shape0*src_stride;
            }
        }
    }
}

/* See documentation of arguments in lowlevel_strided_loops.h */
NPY_NO_EXPORT npy_intp
PyArray_TransferMaskedStridedToNDim(npy_intp ndim,
                char *dst, npy_intp const *dst_strides, npy_intp dst_strides_inc,
                char *src, npy_intp src_stride,
                npy_uint8 *mask, npy_intp mask_stride,
                npy_intp const *coords, npy_intp coords_inc,
                npy_intp const *shape, npy_intp shape_inc,
                npy_intp count, npy_intp src_itemsize,
                NPY_cast_info *cast_info)
{
    npy_intp i, M, N, coord0, shape0, dst_stride0, coord1, shape1, dst_stride1;
    PyArray_MaskedStridedUnaryOp *stransfer =
            (PyArray_MaskedStridedUnaryOp*)cast_info->func;

    /* Finish off dimension 0 */
    coord0 = coords[0];
    shape0 = shape[0];
    dst_stride0 = dst_strides[0];
    N = shape0 - coord0;

    npy_intp strides[2] = {src_stride, dst_stride0};

    char *args[2] = {src, dst};
    if (N >= count) {
        return stransfer(&cast_info->context,
                args, &count, strides, mask, mask_stride, cast_info->auxdata);
    }
    int res = stransfer(&cast_info->context,
            args, &N, strides, mask, mask_stride, cast_info->auxdata);
    if (res < 0) {
        return -1;
    }
    count -= N;

    /* If it's 1-dimensional, there's no more to copy */
    if (ndim == 1) {
        return count;
    }

    /* Adjust the src and dst pointers */
    coord1 = (coords + coords_inc)[0];
    shape1 = (shape + shape_inc)[0];
    dst_stride1 = (dst_strides + dst_strides_inc)[0];
    dst = dst - coord0*dst_stride0 + dst_stride1;
    src += N*src_stride;
    mask += N*mask_stride;

    /* Finish off dimension 1 */
    M = (shape1 - coord1 - 1);
    N = shape0*M;
    for (i = 0; i < M; ++i) {
        args[0] = src; args[1] = dst;
        if (shape0 >= count) {
            return stransfer(&cast_info->context,
                    args, &count, strides,
                    mask, mask_stride, cast_info->auxdata);
        }
        else {
            int res =  stransfer(&cast_info->context,
                    args, &shape0, strides,
                    mask, mask_stride, cast_info->auxdata);
            if (res < 0) {
                return -1;
            }
        }
        count -= shape0;
        dst += dst_stride1;
        src += shape0*src_stride;
        mask += shape0*mask_stride;
    }

    /* If it's 2-dimensional, there's no more to copy */
    if (ndim == 2) {
        return count;
    }

    /* General-case loop for everything else */
    else {
        /* Iteration structure for dimensions 2 and up */
        struct {
            npy_intp coord, shape, dst_stride;
        } it[NPY_MAXDIMS];

        /* Copy the coordinates and shape */
        coords += 2*coords_inc;
        shape += 2*shape_inc;
        dst_strides += 2*dst_strides_inc;
        for (i = 0; i < ndim-2; ++i) {
            it[i].coord = coords[0];
            it[i].shape = shape[0];
            it[i].dst_stride = dst_strides[0];
            coords += coords_inc;
            shape += shape_inc;
            dst_strides += dst_strides_inc;
        }

        for (;;) {
            /* Adjust the dst pointer from the dimension 0 and 1 loop */
            dst = dst - shape1*dst_stride1;

            /* Increment to the next coordinate */
            for (i = 0; i < ndim-2; ++i) {
                dst += it[i].dst_stride;
                if (++it[i].coord >= it[i].shape) {
                    it[i].coord = 0;
                    dst -= it[i].dst_stride*it[i].shape;
                }
                else {
                    break;
                }
            }
            /* If the last dimension rolled over, we're done */
            if (i == ndim-2) {
                return count;
            }

            /* A loop for dimensions 0 and 1 */
            for (i = 0; i < shape1; ++i) {
                args[0] = src; args[1] = dst;
                if (shape0 >= count) {
                    return stransfer(&cast_info->context,
                            args, &count, strides, mask,
                            mask_stride, cast_info->auxdata);
                }
                else {
                    int res =  stransfer(&cast_info->context,
                            args, &shape0, strides,
                            mask, mask_stride, cast_info->auxdata);
                    if (res < 0) {
                        return -1;
                    }
                }
                count -= shape0;
                dst += dst_stride1;
                src += shape0*src_stride;
                mask += shape0*mask_stride;
            }
        }
    }
}


/***************************************************************************/
/****************** MapIter (Advanced indexing) Get/Set ********************/
/***************************************************************************/

#line 1441

/*
 * Advanced indexing iteration of arrays when there is a single indexing
 * array which has the same memory order as the value array and both
 * can be trivially iterated (single stride, aligned, no casting necessary).
 */
NPY_NO_EXPORT int
mapiter_trivial_set(PyArrayObject *self, PyArrayObject *ind,
                       PyArrayObject *result)
{
    char *base_ptr, *ind_ptr, *result_ptr;
    npy_intp self_stride, ind_stride, result_stride;
    npy_intp fancy_dim = PyArray_DIM(self, 0);

    npy_intp itersize;

    int is_aligned = IsUintAligned(self) && IsUintAligned(result);
    int needs_api = PyDataType_REFCHK(PyArray_DESCR(self));

    PyArray_CopySwapFunc *copyswap = PyArray_DESCR(self)->f->copyswap;
    NPY_BEGIN_THREADS_DEF;

    base_ptr = PyArray_BYTES(self);
    self_stride = PyArray_STRIDE(self, 0);

    PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(ind, result, itersize,
                                           ind_ptr, result_ptr,
                                           ind_stride, result_stride)

    if (!needs_api) {
        NPY_BEGIN_THREADS_THRESHOLDED(PyArray_SIZE(ind));
    }
#if !0
    /* Check the indices beforehand */
    while (itersize--) {
        npy_intp indval = *((npy_intp*)ind_ptr);
        if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
            return -1;
        }
        ind_ptr += ind_stride;
    }

    /*
     * Reset the ind_ptr and itersize, due to broadcasting it is always
     * the size of ind.
     */
    ind_ptr = PyArray_BYTES(ind);
    itersize = PyArray_SIZE(ind);
#endif

    /* Optimization for aligned types that do not need the api */
    switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(self) : 0) {

#line 1498

#if 1
    case 1:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 0
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 0
#if 1
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint8)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint8)));
            *(npy_uint8 *)result_ptr = *(npy_uint8 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !0 */
#if 1
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint8)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint8)));
            *(npy_uint8 *)self_ptr = *(npy_uint8 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 2
    case 2:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 0
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 0
#if 2
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint16)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint16)));
            *(npy_uint16 *)result_ptr = *(npy_uint16 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !0 */
#if 2
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint16)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint16)));
            *(npy_uint16 *)self_ptr = *(npy_uint16 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 4
    case 4:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 0
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 0
#if 4
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint32)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint32)));
            *(npy_uint32 *)result_ptr = *(npy_uint32 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !0 */
#if 4
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint32)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint32)));
            *(npy_uint32 *)self_ptr = *(npy_uint32 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 8
    case 8:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 0
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 0
#if 8
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint64)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint64)));
            *(npy_uint64 *)result_ptr = *(npy_uint64 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !0 */
#if 8
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint64)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint64)));
            *(npy_uint64 *)self_ptr = *(npy_uint64 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 0
    case 0:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 0
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 0
#if 0
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(0)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(0)));
            *(0 *)result_ptr = *(0 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !0 */
#if 0
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(0)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(0)));
            *(0 *)self_ptr = *(0 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


    }

    NPY_END_THREADS;

    return 0;
}


/*
 * General advanced indexing iteration.
 */
NPY_NO_EXPORT int
mapiter_set(PyArrayMapIterObject *mit)
{
    npy_intp *counter, count;
    int i, is_aligned;

    /* Cached mit info */
    int numiter = mit->numiter;
    int needs_api = mit->needs_api;
    /* Constant information */
    npy_intp fancy_dims[NPY_MAXDIMS];
    npy_intp fancy_strides[NPY_MAXDIMS];
#if 0
    int iteraxis;
#endif

    char *baseoffset = mit->baseoffset;
    char **outer_ptrs = mit->outer_ptrs;
    npy_intp *outer_strides = mit->outer_strides;
    PyArrayObject *array= mit->array;

    /* Fill constant information */
#if 0
    iteraxis = mit->iteraxes[0];
#endif
    for (i = 0; i < numiter; i++) {
        fancy_dims[i] = mit->fancy_dims[i];
        fancy_strides[i] = mit->fancy_strides[i];
    }

    /*
     * Alignment information (swapping is never needed, since we buffer),
     * could also check extra_op is buffered, but it should rarely matter.
     */

    is_aligned = IsUintAligned(array) && IsUintAligned(mit->extra_op);

    if (mit->size == 0) {
       return 0;
    }

    if (mit->subspace_iter == NULL) {
        /*
         * Item by item copy situation, the operand is buffered
         * so use copyswap.
         */
         PyArray_CopySwapFunc *copyswap = PyArray_DESCR(array)->f->copyswap;

        /* We have only one iterator handling everything */
        counter = NpyIter_GetInnerLoopSizePtr(mit->outer);

        /************ Optimized inner loops without subspace *************/

#line 1612

#if 1
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Optimization for aligned types that do not need the api */
            switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(array) : 0) {

#line 1630

#if 1
            case 1:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)(outer_ptrs[i]) = *(npy_uint8 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)self_ptr = *(npy_uint8 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 2
            case 2:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)(outer_ptrs[i]) = *(npy_uint16 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)self_ptr = *(npy_uint16 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 4
            case 4:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)(outer_ptrs[i]) = *(npy_uint32 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)self_ptr = *(npy_uint32 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 8
            case 8:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)(outer_ptrs[i]) = *(npy_uint64 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)self_ptr = *(npy_uint64 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 0
            case 0:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(0)));
                        *(0 *)(outer_ptrs[i]) = *(0 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(0)));
                        *(0 *)self_ptr = *(0 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


            }
            NPY_END_THREADS;
        }

#line 1612

#if 0
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Optimization for aligned types that do not need the api */
            switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(array) : 0) {

#line 1630

#if 1
            case 1:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)(outer_ptrs[i]) = *(npy_uint8 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)self_ptr = *(npy_uint8 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 2
            case 2:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)(outer_ptrs[i]) = *(npy_uint16 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)self_ptr = *(npy_uint16 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 4
            case 4:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)(outer_ptrs[i]) = *(npy_uint32 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)self_ptr = *(npy_uint32 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 8
            case 8:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)(outer_ptrs[i]) = *(npy_uint64 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)self_ptr = *(npy_uint64 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 0
            case 0:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !0
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 0 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 0
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(0)));
                        *(0 *)(outer_ptrs[i]) = *(0 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !0 */
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(0)));
                        *(0 *)self_ptr = *(0 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


            }
            NPY_END_THREADS;
        }

    }

    /******************* Nested Iteration Situation *******************/
    else {
        char *subspace_baseptrs[2];
        char **subspace_ptrs = mit->subspace_ptrs;
        npy_intp *subspace_strides = mit->subspace_strides;
        int is_subiter_trivial = 0; /* has three states */
        npy_intp reset_offsets[2] = {0, 0};

        /* Use strided transfer functions for the inner loop */
        npy_intp fixed_strides[2];

        /*
         * Get a dtype transfer function, since there are no
         * buffers, this is safe.
         */
        NpyIter_GetInnerFixedStrideArray(mit->subspace_iter, fixed_strides);

        NPY_cast_info cast_info;
        if (PyArray_GetDTypeTransferFunction(is_aligned,
#if 0
                        fixed_strides[0], fixed_strides[1],
                        PyArray_DESCR(array), PyArray_DESCR(mit->extra_op),
#else
                        fixed_strides[1], fixed_strides[0],
                         PyArray_DESCR(mit->extra_op), PyArray_DESCR(array),
#endif
                        0,
                        &cast_info,
                        &needs_api) != NPY_SUCCEED) {
            return -1;
        }

        counter = NpyIter_GetInnerLoopSizePtr(mit->subspace_iter);
        if (*counter == PyArray_SIZE(mit->subspace)) {
           /*
            * subspace is trivially iterable.
            * manipulate pointers to avoid expensive resetting
            */
            is_subiter_trivial = 1;
        }
#line 1750

#if 1
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Outer iteration (safe because mit->size != 0) */
            do {
                char * self_ptr = baseoffset;
                for (i=0; i < 1; i++) {
                    npy_intp indval = *((npy_intp*)outer_ptrs[i]);

#if 0 && 1
                    if (check_and_adjust_index(&indval, fancy_dims[i],
                                               iteraxis, _save) < 0 ) {
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    if (indval < 0) {
                        indval += fancy_dims[i];
                    }
#endif

                    self_ptr += indval * fancy_strides[i];
                }

                /*
                 * Resetting is slow, so try to avoid resetting
                 * if subspace iteration is trivial.
                 * Watch out: reset_offsets are kept outside of the loop,
                 * assuming the subspaces of different external iterations
                 * share the same structure.
                 */
                if (is_subiter_trivial <= 1) {
                    /* slower resetting: first iteration or non-trivial subspace */

                    char * errmsg = NULL;
                    subspace_baseptrs[0] = self_ptr;
                    subspace_baseptrs[1] = mit->extra_op_ptrs[0];

                    /* (can't really fail, since no buffering necessary) */
                    if (!NpyIter_ResetBasePointers(mit->subspace_iter,
                                                   subspace_baseptrs,
                                                   &errmsg)) {
                        NPY_END_THREADS;
                        PyErr_SetString(PyExc_ValueError, errmsg);
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
                    if (is_subiter_trivial != 0) {
                        /* reset_offsets are nonzero for negative strides.*/
                        reset_offsets[0] = subspace_ptrs[0] - self_ptr;
                        reset_offsets[1] = subspace_ptrs[1] - mit->extra_op_ptrs[0];

                        /* use the faster adjustment further on */
                        is_subiter_trivial ++;
                    }
                }
                else {
                    /*
                     * faster resetting if the subspace iteration is trivial.
                     * reset_offsets are zero for positive strides,
                     * for negative strides this shifts the pointer to the last
                     * item.
                     */
                    subspace_ptrs[0] = self_ptr + reset_offsets[0];
                    subspace_ptrs[1] = mit->extra_op_ptrs[0] + reset_offsets[1];
                }

#if !0
                /*
                 * When the API is needed the casting might fail
                 * TODO: Could only check if casting is unsafe, or even just
                 *       not at all...
                 */
                if (needs_api && PyErr_Occurred()) {
                    NPY_cast_info_xfree(&cast_info);
                    return -1;
                }
#endif

                do {

#if 0
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            subspace_ptrs, counter, subspace_strides,
                            cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    /* The operand order is reveresed here */
                    char *args[2] = {subspace_ptrs[1], subspace_ptrs[0]};
                    npy_intp strides[2] = {subspace_strides[1], subspace_strides[0]};
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            args, counter, strides, cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#endif
                } while (mit->subspace_next(mit->subspace_iter));

                mit->extra_op_next(mit->extra_op_iter);
            } while (mit->outer_next(mit->outer));
            NPY_END_THREADS;
        }

#line 1750

#if 0
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Outer iteration (safe because mit->size != 0) */
            do {
                char * self_ptr = baseoffset;
                for (i=0; i < numiter; i++) {
                    npy_intp indval = *((npy_intp*)outer_ptrs[i]);

#if 0 && 0
                    if (check_and_adjust_index(&indval, fancy_dims[i],
                                               iteraxis, _save) < 0 ) {
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    if (indval < 0) {
                        indval += fancy_dims[i];
                    }
#endif

                    self_ptr += indval * fancy_strides[i];
                }

                /*
                 * Resetting is slow, so try to avoid resetting
                 * if subspace iteration is trivial.
                 * Watch out: reset_offsets are kept outside of the loop,
                 * assuming the subspaces of different external iterations
                 * share the same structure.
                 */
                if (is_subiter_trivial <= 1) {
                    /* slower resetting: first iteration or non-trivial subspace */

                    char * errmsg = NULL;
                    subspace_baseptrs[0] = self_ptr;
                    subspace_baseptrs[1] = mit->extra_op_ptrs[0];

                    /* (can't really fail, since no buffering necessary) */
                    if (!NpyIter_ResetBasePointers(mit->subspace_iter,
                                                   subspace_baseptrs,
                                                   &errmsg)) {
                        NPY_END_THREADS;
                        PyErr_SetString(PyExc_ValueError, errmsg);
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
                    if (is_subiter_trivial != 0) {
                        /* reset_offsets are nonzero for negative strides.*/
                        reset_offsets[0] = subspace_ptrs[0] - self_ptr;
                        reset_offsets[1] = subspace_ptrs[1] - mit->extra_op_ptrs[0];

                        /* use the faster adjustment further on */
                        is_subiter_trivial ++;
                    }
                }
                else {
                    /*
                     * faster resetting if the subspace iteration is trivial.
                     * reset_offsets are zero for positive strides,
                     * for negative strides this shifts the pointer to the last
                     * item.
                     */
                    subspace_ptrs[0] = self_ptr + reset_offsets[0];
                    subspace_ptrs[1] = mit->extra_op_ptrs[0] + reset_offsets[1];
                }

#if !0
                /*
                 * When the API is needed the casting might fail
                 * TODO: Could only check if casting is unsafe, or even just
                 *       not at all...
                 */
                if (needs_api && PyErr_Occurred()) {
                    NPY_cast_info_xfree(&cast_info);
                    return -1;
                }
#endif

                do {

#if 0
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            subspace_ptrs, counter, subspace_strides,
                            cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    /* The operand order is reveresed here */
                    char *args[2] = {subspace_ptrs[1], subspace_ptrs[0]};
                    npy_intp strides[2] = {subspace_strides[1], subspace_strides[0]};
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            args, counter, strides, cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#endif
                } while (mit->subspace_next(mit->subspace_iter));

                mit->extra_op_next(mit->extra_op_iter);
            } while (mit->outer_next(mit->outer));
            NPY_END_THREADS;
        }


        NPY_cast_info_xfree(&cast_info);
    }
    return 0;
}


#line 1441

/*
 * Advanced indexing iteration of arrays when there is a single indexing
 * array which has the same memory order as the value array and both
 * can be trivially iterated (single stride, aligned, no casting necessary).
 */
NPY_NO_EXPORT int
mapiter_trivial_get(PyArrayObject *self, PyArrayObject *ind,
                       PyArrayObject *result)
{
    char *base_ptr, *ind_ptr, *result_ptr;
    npy_intp self_stride, ind_stride, result_stride;
    npy_intp fancy_dim = PyArray_DIM(self, 0);

    npy_intp itersize;

    int is_aligned = IsUintAligned(self) && IsUintAligned(result);
    int needs_api = PyDataType_REFCHK(PyArray_DESCR(self));

    PyArray_CopySwapFunc *copyswap = PyArray_DESCR(self)->f->copyswap;
    NPY_BEGIN_THREADS_DEF;

    base_ptr = PyArray_BYTES(self);
    self_stride = PyArray_STRIDE(self, 0);

    PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(ind, result, itersize,
                                           ind_ptr, result_ptr,
                                           ind_stride, result_stride)

    if (!needs_api) {
        NPY_BEGIN_THREADS_THRESHOLDED(PyArray_SIZE(ind));
    }
#if !1
    /* Check the indices beforehand */
    while (itersize--) {
        npy_intp indval = *((npy_intp*)ind_ptr);
        if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
            return -1;
        }
        ind_ptr += ind_stride;
    }

    /*
     * Reset the ind_ptr and itersize, due to broadcasting it is always
     * the size of ind.
     */
    ind_ptr = PyArray_BYTES(ind);
    itersize = PyArray_SIZE(ind);
#endif

    /* Optimization for aligned types that do not need the api */
    switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(self) : 0) {

#line 1498

#if 1
    case 1:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 1
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 1
#if 1
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint8)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint8)));
            *(npy_uint8 *)result_ptr = *(npy_uint8 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !1 */
#if 1
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint8)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint8)));
            *(npy_uint8 *)self_ptr = *(npy_uint8 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 2
    case 2:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 1
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 1
#if 2
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint16)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint16)));
            *(npy_uint16 *)result_ptr = *(npy_uint16 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !1 */
#if 2
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint16)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint16)));
            *(npy_uint16 *)self_ptr = *(npy_uint16 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 4
    case 4:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 1
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 1
#if 4
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint32)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint32)));
            *(npy_uint32 *)result_ptr = *(npy_uint32 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !1 */
#if 4
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint32)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint32)));
            *(npy_uint32 *)self_ptr = *(npy_uint32 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 8
    case 8:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 1
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 1
#if 8
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint64)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint64)));
            *(npy_uint64 *)result_ptr = *(npy_uint64 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !1 */
#if 8
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(npy_uint64)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(npy_uint64)));
            *(npy_uint64 *)self_ptr = *(npy_uint64 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


#line 1498

#if 0
    case 0:
#else
    default:
#endif
        while (itersize--) {
            char * self_ptr;
            npy_intp indval = *((npy_intp*)ind_ptr);
            assert(npy_is_aligned(ind_ptr, _UINT_ALIGN(npy_intp)));
#if 1
            if (check_and_adjust_index(&indval, fancy_dim, 0, _save) < 0 ) {
                return -1;
            }
#else
            if (indval < 0) {
                indval += fancy_dim;
            }
#endif
            self_ptr = base_ptr + indval * self_stride;

#if 1
#if 0
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(0)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(0)));
            *(0 *)result_ptr = *(0 *)self_ptr;
#else
            copyswap(result_ptr, self_ptr, 0, self);
#endif

#else /* !1 */
#if 0
            assert(npy_is_aligned(result_ptr, _UINT_ALIGN(0)));
            assert(npy_is_aligned(self_ptr, _UINT_ALIGN(0)));
            *(0 *)self_ptr = *(0 *)result_ptr;
#else
            copyswap(self_ptr, result_ptr, 0, self);
#endif
#endif

            ind_ptr += ind_stride;
            result_ptr += result_stride;
        }
        break;


    }

    NPY_END_THREADS;

    return 0;
}


/*
 * General advanced indexing iteration.
 */
NPY_NO_EXPORT int
mapiter_get(PyArrayMapIterObject *mit)
{
    npy_intp *counter, count;
    int i, is_aligned;

    /* Cached mit info */
    int numiter = mit->numiter;
    int needs_api = mit->needs_api;
    /* Constant information */
    npy_intp fancy_dims[NPY_MAXDIMS];
    npy_intp fancy_strides[NPY_MAXDIMS];
#if 1
    int iteraxis;
#endif

    char *baseoffset = mit->baseoffset;
    char **outer_ptrs = mit->outer_ptrs;
    npy_intp *outer_strides = mit->outer_strides;
    PyArrayObject *array= mit->array;

    /* Fill constant information */
#if 1
    iteraxis = mit->iteraxes[0];
#endif
    for (i = 0; i < numiter; i++) {
        fancy_dims[i] = mit->fancy_dims[i];
        fancy_strides[i] = mit->fancy_strides[i];
    }

    /*
     * Alignment information (swapping is never needed, since we buffer),
     * could also check extra_op is buffered, but it should rarely matter.
     */

    is_aligned = IsUintAligned(array) && IsUintAligned(mit->extra_op);

    if (mit->size == 0) {
       return 0;
    }

    if (mit->subspace_iter == NULL) {
        /*
         * Item by item copy situation, the operand is buffered
         * so use copyswap.
         */
         PyArray_CopySwapFunc *copyswap = PyArray_DESCR(array)->f->copyswap;

        /* We have only one iterator handling everything */
        counter = NpyIter_GetInnerLoopSizePtr(mit->outer);

        /************ Optimized inner loops without subspace *************/

#line 1612

#if 1
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Optimization for aligned types that do not need the api */
            switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(array) : 0) {

#line 1630

#if 1
            case 1:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)(outer_ptrs[i]) = *(npy_uint8 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)self_ptr = *(npy_uint8 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 2
            case 2:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)(outer_ptrs[i]) = *(npy_uint16 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)self_ptr = *(npy_uint16 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 4
            case 4:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)(outer_ptrs[i]) = *(npy_uint32 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)self_ptr = *(npy_uint32 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 8
            case 8:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)(outer_ptrs[i]) = *(npy_uint64 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)self_ptr = *(npy_uint64 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 0
            case 0:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < 1; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 1
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(0)));
                        *(0 *)(outer_ptrs[i]) = *(0 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(0)));
                        *(0 *)self_ptr = *(0 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


            }
            NPY_END_THREADS;
        }

#line 1612

#if 0
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Optimization for aligned types that do not need the api */
            switch ((is_aligned && !needs_api) ? PyArray_ITEMSIZE(array) : 0) {

#line 1630

#if 1
            case 1:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)(outer_ptrs[i]) = *(npy_uint8 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 1
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint8)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint8)));
                        *(npy_uint8 *)self_ptr = *(npy_uint8 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 2
            case 2:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)(outer_ptrs[i]) = *(npy_uint16 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 2
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint16)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint16)));
                        *(npy_uint16 *)self_ptr = *(npy_uint16 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 4
            case 4:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)(outer_ptrs[i]) = *(npy_uint32 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 4
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint32)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint32)));
                        *(npy_uint32 *)self_ptr = *(npy_uint32 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 8
            case 8:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)(outer_ptrs[i]) = *(npy_uint64 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 8
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(npy_uint64)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(npy_uint64)));
                        *(npy_uint64 *)self_ptr = *(npy_uint64 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


#line 1630

#if 0
            case 0:
#else
            default:
#endif
                /* Outer iteration (safe because mit->size != 0) */
                do {
#if !1
                    /*
                     * When the API is needed the casting might fail
                     * TODO: (only if buffering is enabled).
                     */
                    if (needs_api && PyErr_Occurred()) {
                        return -1;
                    }
#endif
                    count = *counter;
                    while (count--) {
                        char * self_ptr = baseoffset;
                        for (i=0; i < numiter; i++) {
                            npy_intp indval = *((npy_intp*)outer_ptrs[i]);
                            assert(npy_is_aligned(outer_ptrs[i],
                                                  _UINT_ALIGN(npy_intp)));

#if 1 && 0
                            if (check_and_adjust_index(&indval, fancy_dims[i],
                                                       iteraxis, _save) < 0 ) {
                                return -1;
                            }
#else
                            if (indval < 0) {
                                indval += fancy_dims[i];
                            }
#endif
                            self_ptr += indval * fancy_strides[i];

                            /* advance indexing arrays */
                            outer_ptrs[i] += outer_strides[i];
                        }

#if 1
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                                              _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                                              _UINT_ALIGN(0)));
                        *(0 *)(outer_ptrs[i]) = *(0 *)self_ptr;
#else
                        copyswap(outer_ptrs[i], self_ptr, 0, array);
#endif
#else /* !1 */
#if 0
                        assert(npy_is_aligned(outer_ptrs[i],
                               _UINT_ALIGN(0)));
                        assert(npy_is_aligned(self_ptr,
                               _UINT_ALIGN(0)));
                        *(0 *)self_ptr = *(0 *)(outer_ptrs[i]);
#else
                        copyswap(self_ptr, outer_ptrs[i], 0, array);
#endif
#endif
                        /* advance extra operand */
                        outer_ptrs[i] += outer_strides[i];
                    }
                } while (mit->outer_next(mit->outer));

                break;


            }
            NPY_END_THREADS;
        }

    }

    /******************* Nested Iteration Situation *******************/
    else {
        char *subspace_baseptrs[2];
        char **subspace_ptrs = mit->subspace_ptrs;
        npy_intp *subspace_strides = mit->subspace_strides;
        int is_subiter_trivial = 0; /* has three states */
        npy_intp reset_offsets[2] = {0, 0};

        /* Use strided transfer functions for the inner loop */
        npy_intp fixed_strides[2];

        /*
         * Get a dtype transfer function, since there are no
         * buffers, this is safe.
         */
        NpyIter_GetInnerFixedStrideArray(mit->subspace_iter, fixed_strides);

        NPY_cast_info cast_info;
        if (PyArray_GetDTypeTransferFunction(is_aligned,
#if 1
                        fixed_strides[0], fixed_strides[1],
                        PyArray_DESCR(array), PyArray_DESCR(mit->extra_op),
#else
                        fixed_strides[1], fixed_strides[0],
                         PyArray_DESCR(mit->extra_op), PyArray_DESCR(array),
#endif
                        0,
                        &cast_info,
                        &needs_api) != NPY_SUCCEED) {
            return -1;
        }

        counter = NpyIter_GetInnerLoopSizePtr(mit->subspace_iter);
        if (*counter == PyArray_SIZE(mit->subspace)) {
           /*
            * subspace is trivially iterable.
            * manipulate pointers to avoid expensive resetting
            */
            is_subiter_trivial = 1;
        }
#line 1750

#if 1
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Outer iteration (safe because mit->size != 0) */
            do {
                char * self_ptr = baseoffset;
                for (i=0; i < 1; i++) {
                    npy_intp indval = *((npy_intp*)outer_ptrs[i]);

#if 1 && 1
                    if (check_and_adjust_index(&indval, fancy_dims[i],
                                               iteraxis, _save) < 0 ) {
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    if (indval < 0) {
                        indval += fancy_dims[i];
                    }
#endif

                    self_ptr += indval * fancy_strides[i];
                }

                /*
                 * Resetting is slow, so try to avoid resetting
                 * if subspace iteration is trivial.
                 * Watch out: reset_offsets are kept outside of the loop,
                 * assuming the subspaces of different external iterations
                 * share the same structure.
                 */
                if (is_subiter_trivial <= 1) {
                    /* slower resetting: first iteration or non-trivial subspace */

                    char * errmsg = NULL;
                    subspace_baseptrs[0] = self_ptr;
                    subspace_baseptrs[1] = mit->extra_op_ptrs[0];

                    /* (can't really fail, since no buffering necessary) */
                    if (!NpyIter_ResetBasePointers(mit->subspace_iter,
                                                   subspace_baseptrs,
                                                   &errmsg)) {
                        NPY_END_THREADS;
                        PyErr_SetString(PyExc_ValueError, errmsg);
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
                    if (is_subiter_trivial != 0) {
                        /* reset_offsets are nonzero for negative strides.*/
                        reset_offsets[0] = subspace_ptrs[0] - self_ptr;
                        reset_offsets[1] = subspace_ptrs[1] - mit->extra_op_ptrs[0];

                        /* use the faster adjustment further on */
                        is_subiter_trivial ++;
                    }
                }
                else {
                    /*
                     * faster resetting if the subspace iteration is trivial.
                     * reset_offsets are zero for positive strides,
                     * for negative strides this shifts the pointer to the last
                     * item.
                     */
                    subspace_ptrs[0] = self_ptr + reset_offsets[0];
                    subspace_ptrs[1] = mit->extra_op_ptrs[0] + reset_offsets[1];
                }

#if !1
                /*
                 * When the API is needed the casting might fail
                 * TODO: Could only check if casting is unsafe, or even just
                 *       not at all...
                 */
                if (needs_api && PyErr_Occurred()) {
                    NPY_cast_info_xfree(&cast_info);
                    return -1;
                }
#endif

                do {

#if 1
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            subspace_ptrs, counter, subspace_strides,
                            cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    /* The operand order is reveresed here */
                    char *args[2] = {subspace_ptrs[1], subspace_ptrs[0]};
                    npy_intp strides[2] = {subspace_strides[1], subspace_strides[0]};
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            args, counter, strides, cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#endif
                } while (mit->subspace_next(mit->subspace_iter));

                mit->extra_op_next(mit->extra_op_iter);
            } while (mit->outer_next(mit->outer));
            NPY_END_THREADS;
        }

#line 1750

#if 0
        if (numiter == 1) {
#else
        else {
#endif
            NPY_BEGIN_THREADS_DEF;
            if (!needs_api) {
                NPY_BEGIN_THREADS;
            }

            /* Outer iteration (safe because mit->size != 0) */
            do {
                char * self_ptr = baseoffset;
                for (i=0; i < numiter; i++) {
                    npy_intp indval = *((npy_intp*)outer_ptrs[i]);

#if 1 && 0
                    if (check_and_adjust_index(&indval, fancy_dims[i],
                                               iteraxis, _save) < 0 ) {
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    if (indval < 0) {
                        indval += fancy_dims[i];
                    }
#endif

                    self_ptr += indval * fancy_strides[i];
                }

                /*
                 * Resetting is slow, so try to avoid resetting
                 * if subspace iteration is trivial.
                 * Watch out: reset_offsets are kept outside of the loop,
                 * assuming the subspaces of different external iterations
                 * share the same structure.
                 */
                if (is_subiter_trivial <= 1) {
                    /* slower resetting: first iteration or non-trivial subspace */

                    char * errmsg = NULL;
                    subspace_baseptrs[0] = self_ptr;
                    subspace_baseptrs[1] = mit->extra_op_ptrs[0];

                    /* (can't really fail, since no buffering necessary) */
                    if (!NpyIter_ResetBasePointers(mit->subspace_iter,
                                                   subspace_baseptrs,
                                                   &errmsg)) {
                        NPY_END_THREADS;
                        PyErr_SetString(PyExc_ValueError, errmsg);
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
                    if (is_subiter_trivial != 0) {
                        /* reset_offsets are nonzero for negative strides.*/
                        reset_offsets[0] = subspace_ptrs[0] - self_ptr;
                        reset_offsets[1] = subspace_ptrs[1] - mit->extra_op_ptrs[0];

                        /* use the faster adjustment further on */
                        is_subiter_trivial ++;
                    }
                }
                else {
                    /*
                     * faster resetting if the subspace iteration is trivial.
                     * reset_offsets are zero for positive strides,
                     * for negative strides this shifts the pointer to the last
                     * item.
                     */
                    subspace_ptrs[0] = self_ptr + reset_offsets[0];
                    subspace_ptrs[1] = mit->extra_op_ptrs[0] + reset_offsets[1];
                }

#if !1
                /*
                 * When the API is needed the casting might fail
                 * TODO: Could only check if casting is unsafe, or even just
                 *       not at all...
                 */
                if (needs_api && PyErr_Occurred()) {
                    NPY_cast_info_xfree(&cast_info);
                    return -1;
                }
#endif

                do {

#if 1
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            subspace_ptrs, counter, subspace_strides,
                            cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#else
                    /* The operand order is reveresed here */
                    char *args[2] = {subspace_ptrs[1], subspace_ptrs[0]};
                    npy_intp strides[2] = {subspace_strides[1], subspace_strides[0]};
                    if (NPY_UNLIKELY(cast_info.func(&cast_info.context,
                            args, counter, strides, cast_info.auxdata) < 0)) {
                        NPY_END_THREADS;
                        NPY_cast_info_xfree(&cast_info);
                        return -1;
                    }
#endif
                } while (mit->subspace_next(mit->subspace_iter));

                mit->extra_op_next(mit->extra_op_iter);
            } while (mit->outer_next(mit->outer));
            NPY_END_THREADS;
        }


        NPY_cast_info_xfree(&cast_info);
    }
    return 0;
}



