# 1 "hal/lib/hal_accessor.h"
# 1 "/home/mah/machinekit/src//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "hal/lib/hal_accessor.h"


# 1 "./config.h" 1
# 4 "hal/lib/hal_accessor.h" 2
# 1 "rtapi/rtapi.h" 1
# 84 "rtapi/rtapi.h"
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 147 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
typedef long int ptrdiff_t;
# 212 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
typedef long unsigned int size_t;
# 324 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
typedef int wchar_t;
# 422 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
typedef struct {
    long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
    long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
# 85 "rtapi/rtapi.h" 2
# 1 "rtapi/rtapi_int.h" 1
# 27 "rtapi/rtapi_int.h"
# 1 "/usr/include/x86_64-linux-gnu/asm/types.h" 1 3 4



# 1 "/usr/include/asm-generic/types.h" 1 3 4





# 1 "/usr/include/asm-generic/int-ll64.h" 1 3 4
# 11 "/usr/include/asm-generic/int-ll64.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 1 3 4
# 10 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 3 4
# 1 "/usr/include/asm-generic/bitsperlong.h" 1 3 4
# 11 "/usr/include/x86_64-linux-gnu/asm/bitsperlong.h" 2 3 4
# 12 "/usr/include/asm-generic/int-ll64.h" 2 3 4







typedef __signed__ char __s8;
typedef unsigned char __u8;

typedef __signed__ short __s16;
typedef unsigned short __u16;

typedef __signed__ int __s32;
typedef unsigned int __u32;


__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
# 7 "/usr/include/asm-generic/types.h" 2 3 4
# 5 "/usr/include/x86_64-linux-gnu/asm/types.h" 2 3 4
# 28 "rtapi/rtapi_int.h" 2


# 1 "/usr/local/include/ck_limits.h" 1 3
# 44 "/usr/local/include/ck_limits.h" 3
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 1 3 4
# 34 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h" 1 3 4






# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 1 3 4
# 168 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 3 4
# 1 "/usr/include/limits.h" 1 3 4
# 25 "/usr/include/limits.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 374 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
# 385 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 386 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4
# 375 "/usr/include/features.h" 2 3 4
# 398 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4
# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4
# 399 "/usr/include/features.h" 2 3 4
# 26 "/usr/include/limits.h" 2 3 4
# 143 "/usr/include/limits.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4
# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4
# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4
# 1 "/usr/include/linux/limits.h" 1 3 4
# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4
# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4
# 144 "/usr/include/limits.h" 2 3 4



# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4
# 148 "/usr/include/limits.h" 2 3 4



# 1 "/usr/include/x86_64-linux-gnu/bits/xopen_lim.h" 1 3 4
# 33 "/usr/include/x86_64-linux-gnu/bits/xopen_lim.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4
# 34 "/usr/include/x86_64-linux-gnu/bits/xopen_lim.h" 2 3 4
# 152 "/usr/include/limits.h" 2 3 4
# 169 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 2 3 4
# 8 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h" 2 3 4
# 35 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 2 3 4
# 45 "/usr/local/include/ck_limits.h" 2 3
# 31 "rtapi/rtapi_int.h" 2
# 86 "rtapi/rtapi.h" 2
# 97 "rtapi/rtapi.h"
# 1 "rtapi/rtapi_errno.h" 1
# 19 "rtapi/rtapi_errno.h"
# 1 "/usr/include/errno.h" 1 3 4
# 31 "/usr/include/errno.h" 3 4




# 1 "/usr/include/x86_64-linux-gnu/bits/errno.h" 1 3 4
# 24 "/usr/include/x86_64-linux-gnu/bits/errno.h" 3 4
# 1 "/usr/include/linux/errno.h" 1 3 4
# 1 "/usr/include/x86_64-linux-gnu/asm/errno.h" 1 3 4
# 1 "/usr/include/asm-generic/errno.h" 1 3 4



# 1 "/usr/include/asm-generic/errno-base.h" 1 3 4
# 5 "/usr/include/asm-generic/errno.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/asm/errno.h" 2 3 4
# 1 "/usr/include/linux/errno.h" 2 3 4
# 25 "/usr/include/x86_64-linux-gnu/bits/errno.h" 2 3 4
# 50 "/usr/include/x86_64-linux-gnu/bits/errno.h" 3 4
extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
# 36 "/usr/include/errno.h" 2 3 4
# 54 "/usr/include/errno.h" 3 4
extern char *program_invocation_name, *program_invocation_short_name;




# 68 "/usr/include/errno.h" 3 4
typedef int error_t;
# 20 "rtapi/rtapi_errno.h" 2
# 98 "rtapi/rtapi.h" 2




# 1 "/usr/local/include/ck_pr.h" 1 3
# 31 "/usr/local/include/ck_pr.h" 3
# 1 "/usr/local/include/ck_cc.h" 1 3
# 32 "/usr/local/include/ck_cc.h" 3
# 1 "/usr/local/include/gcc/ck_cc.h" 1 3
# 31 "/usr/local/include/gcc/ck_cc.h" 3
# 1 "/usr/local/include/ck_md.h" 1 3
# 32 "/usr/local/include/gcc/ck_cc.h" 2 3
# 116 "/usr/local/include/gcc/ck_cc.h" 3
__attribute__((unused)) static int
ck_cc_ffs(unsigned int x)
{

    return __builtin_ffs(x);
}

__attribute__((unused)) static int
ck_cc_clz(unsigned int x)
{

    return __builtin_clz(x);
}

__attribute__((unused)) static int
ck_cc_ctz(unsigned int x)
{

    return __builtin_ctz(x);
}

__attribute__((unused)) static int
ck_cc_popcount(unsigned int x)
{

    return __builtin_popcount(x);
}
# 33 "/usr/local/include/ck_cc.h" 2 3
# 32 "/usr/local/include/ck_pr.h" 2 3
# 1 "/usr/local/include/ck_limits.h" 1 3
# 44 "/usr/local/include/ck_limits.h" 3
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h" 1 3 4
# 45 "/usr/local/include/ck_limits.h" 2 3
# 33 "/usr/local/include/ck_pr.h" 2 3

# 1 "/usr/local/include/ck_stdint.h" 1 3
# 31 "/usr/local/include/ck_stdint.h" 3
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 1 3 4
# 9 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 3 4
# 1 "/usr/include/stdint.h" 1 3 4
# 26 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4
# 27 "/usr/include/stdint.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 28 "/usr/include/stdint.h" 2 3 4
# 36 "/usr/include/stdint.h" 3 4
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;

typedef long int int64_t;







typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;



typedef unsigned long int uint64_t;
# 65 "/usr/include/stdint.h" 3 4
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;

typedef long int int_least64_t;






typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;

typedef unsigned long int uint_least64_t;
# 90 "/usr/include/stdint.h" 3 4
typedef signed char int_fast8_t;

typedef long int int_fast16_t;
typedef long int int_fast32_t;
typedef long int int_fast64_t;
# 103 "/usr/include/stdint.h" 3 4
typedef unsigned char uint_fast8_t;

typedef unsigned long int uint_fast16_t;
typedef unsigned long int uint_fast32_t;
typedef unsigned long int uint_fast64_t;
# 119 "/usr/include/stdint.h" 3 4
typedef long int intptr_t;


typedef unsigned long int uintptr_t;
# 134 "/usr/include/stdint.h" 3 4
typedef long int intmax_t;
typedef unsigned long int uintmax_t;
# 10 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 2 3 4
# 32 "/usr/local/include/ck_stdint.h" 2 3
# 35 "/usr/local/include/ck_pr.h" 2 3
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdbool.h" 1 3 4
# 36 "/usr/local/include/ck_pr.h" 2 3



# 1 "/usr/local/include/gcc/x86_64/ck_pr.h" 1 3
# 36 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
# 1 "/usr/local/include/ck_stdint.h" 1 3
# 37 "/usr/local/include/gcc/x86_64/ck_pr.h" 2 3






# 1 "/usr/local/include/gcc/x86_64/ck_f_pr.h" 1 3
# 44 "/usr/local/include/gcc/x86_64/ck_pr.h" 2 3
# 65 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void
ck_pr_stall(void)
{
    __asm__ __volatile__("pause" ::: "memory");
    return;
}
# 79 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_fence_strict_atomic(void)
{
    __asm__ __volatile__("sfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_atomic_store(void)
{
    __asm__ __volatile__("sfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_atomic_load(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_store_atomic(void)
{
    __asm__ __volatile__("sfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_load_atomic(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_load(void)
{
    __asm__ __volatile__("lfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_load_store(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_store(void)
{
    __asm__ __volatile__("sfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_store_load(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_memory(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_release(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_acquire(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_lock(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
__attribute__((unused)) static void ck_pr_fence_strict_unlock(void)
{
    __asm__ __volatile__("mfence" ::: "memory");
}
# 103 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void
ck_pr_rfo(const void *m)
{

    __asm__ __volatile__("prefetchw (%0)"
                         :
                         : "r" (m)
                         : "memory");

    return;
}
# 131 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void * ck_pr_fas_ptr(void *target, void * v)
{
    __asm__ __volatile__("xchgq" " %0, %1" : "+m" (*(char *)target), "+q" (v) : : "memory");
    return v;
}



__attribute__((unused)) static double ck_pr_fas_double(double *target, double v)
{
    __asm__ __volatile__("xchgq" " %0, %1" : "+m" (*(double *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static char ck_pr_fas_char(char *target, char v)
{
    __asm__ __volatile__("xchgb" " %0, %1" : "+m" (*(char *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static unsigned int ck_pr_fas_uint(unsigned int *target, unsigned int v)
{
    __asm__ __volatile__("xchgl" " %0, %1" : "+m" (*(unsigned int *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static int ck_pr_fas_int(int *target, int v)
{
    __asm__ __volatile__("xchgl" " %0, %1" : "+m" (*(int *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static uint64_t ck_pr_fas_64(uint64_t *target, uint64_t v)
{
    __asm__ __volatile__("xchgq" " %0, %1" : "+m" (*(uint64_t *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static uint32_t ck_pr_fas_32(uint32_t *target, uint32_t v)
{
    __asm__ __volatile__("xchgl" " %0, %1" : "+m" (*(uint32_t *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static uint16_t ck_pr_fas_16(uint16_t *target, uint16_t v)
{
    __asm__ __volatile__("xchgw" " %0, %1" : "+m" (*(uint16_t *)target), "+q" (v) : : "memory");
    return v;
}
__attribute__((unused)) static uint8_t ck_pr_fas_8(uint8_t *target, uint8_t v)
{
    __asm__ __volatile__("xchgb" " %0, %1" : "+m" (*(uint8_t *)target), "+q" (v) : : "memory");
    return v;
}
# 162 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void * ck_pr_md_load_ptr(const void *target)
{
    void * r;
    __asm__ __volatile__("movq" " %1, %0" : "=q" (r) : "m" (*(const char *)target) : "memory");
    return (r);
}



__attribute__((unused)) static char ck_pr_md_load_char(const char *target)
{
    char r;
    __asm__ __volatile__("movb" " %1, %0" : "=q" (r) : "m" (*(const char *)target) : "memory");
    return (r);
}
__attribute__((unused)) static unsigned int ck_pr_md_load_uint(const unsigned int *target)
{
    unsigned int r;
    __asm__ __volatile__("movl" " %1, %0" : "=q" (r) : "m" (*(const unsigned int *)target) : "memory");
    return (r);
}
__attribute__((unused)) static int ck_pr_md_load_int(const int *target)
{
    int r;
    __asm__ __volatile__("movl" " %1, %0" : "=q" (r) : "m" (*(const int *)target) : "memory");
    return (r);
}
__attribute__((unused)) static double ck_pr_md_load_double(const double *target)
{
    double r;
    __asm__ __volatile__("movq" " %1, %0" : "=q" (r) : "m" (*(const double *)target) : "memory");
    return (r);
}
__attribute__((unused)) static uint64_t ck_pr_md_load_64(const uint64_t *target)
{
    uint64_t r;
    __asm__ __volatile__("movq" " %1, %0" : "=q" (r) : "m" (*(const uint64_t *)target) : "memory");
    return (r);
}
__attribute__((unused)) static uint32_t ck_pr_md_load_32(const uint32_t *target)
{
    uint32_t r;
    __asm__ __volatile__("movl" " %1, %0" : "=q" (r) : "m" (*(const uint32_t *)target) : "memory");
    return (r);
}
__attribute__((unused)) static uint16_t ck_pr_md_load_16(const uint16_t *target)
{
    uint16_t r;
    __asm__ __volatile__("movw" " %1, %0" : "=q" (r) : "m" (*(const uint16_t *)target) : "memory");
    return (r);
}
__attribute__((unused)) static uint8_t ck_pr_md_load_8(const uint8_t *target)
{
    uint8_t r;
    __asm__ __volatile__("movb" " %1, %0" : "=q" (r) : "m" (*(const uint8_t *)target) : "memory");
    return (r);
}




__attribute__((unused)) static void
ck_pr_load_64_2(const uint64_t target[2], uint64_t v[2])
{
    __asm__ __volatile__("movq %%rdx, %%rcx;"
                         "movq %%rax, %%rbx;"
                         "lock " "cmpxchg16b %2;"
                         : "=a" (v[0]),
                         "=d" (v[1])
                         : "m" (*(const uint64_t *)target)
                         : "rbx", "rcx", "memory", "cc");
    return;
}

__attribute__((unused)) static void
ck_pr_load_ptr_2(const void *t, void *v)
{
    ck_pr_load_64_2(t,
                    v);
    return;
}
# 208 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_md_load_char_16(const char t[2], char v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
__attribute__((unused)) static void ck_pr_md_load_int_4(const int t[2], int v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
__attribute__((unused)) static void ck_pr_md_load_uint_4(const unsigned int t[2], unsigned int v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
__attribute__((unused)) static void ck_pr_md_load_32_4(const uint32_t t[2], uint32_t v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
__attribute__((unused)) static void ck_pr_md_load_16_8(const uint16_t t[2], uint16_t v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
__attribute__((unused)) static void ck_pr_md_load_8_16(const uint8_t t[2], uint8_t v[2])
{
    ck_pr_load_64_2((const uint64_t *)(const void *)t, (uint64_t *)(void *)v);
    return;
}
# 242 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_md_store_ptr(void *target, const void * v)
{
    __asm__ __volatile__("movq" " %1, %0" : "=m" (*(char *)target) : "Z" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_double(double *target, double v)
{
    __asm__ __volatile__("movq" " %1, %0" : "=m" (*(double *)target) : "q" (v) : "memory");
    return;
}



__attribute__((unused)) static void ck_pr_md_store_char(char *target, char v)
{
    __asm__ __volatile__("movb" " %1, %0" : "=m" (*(char *)target) : "e" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_int(int *target, int v)
{
    __asm__ __volatile__("movl" " %1, %0" : "=m" (*(int *)target) : "e" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_uint(unsigned int *target, unsigned int v)
{
    __asm__ __volatile__("movl" " %1, %0" : "=m" (*(unsigned int *)target) : "Z" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_64(uint64_t *target, uint64_t v)
{
    __asm__ __volatile__("movq" " %1, %0" : "=m" (*(uint64_t *)target) : "Z" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_32(uint32_t *target, uint32_t v)
{
    __asm__ __volatile__("movl" " %1, %0" : "=m" (*(uint32_t *)target) : "Z" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_16(uint16_t *target, uint16_t v)
{
    __asm__ __volatile__("movw" " %1, %0" : "=m" (*(uint16_t *)target) : "Z" "q" (v) : "memory");
    return;
}
__attribute__((unused)) static void ck_pr_md_store_8(uint8_t *target, uint8_t v)
{
    __asm__ __volatile__("movb" " %1, %0" : "=m" (*(uint8_t *)target) : "Z" "q" (v) : "memory");
    return;
}
# 274 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static uintptr_t ck_pr_faa_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "xaddq" " %1, %0" : "+m" (*(char *)target), "+q" (d) : : "memory", "cc");
    return (d);
}



__attribute__((unused)) static char ck_pr_faa_char(char *target, char d)
{
    __asm__ __volatile__("lock " "xaddb" " %1, %0" : "+m" (*(char *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static unsigned int ck_pr_faa_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "xaddl" " %1, %0" : "+m" (*(unsigned int *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static int ck_pr_faa_int(int *target, int d)
{
    __asm__ __volatile__("lock " "xaddl" " %1, %0" : "+m" (*(int *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static uint64_t ck_pr_faa_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "xaddq" " %1, %0" : "+m" (*(uint64_t *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static uint32_t ck_pr_faa_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "xaddl" " %1, %0" : "+m" (*(uint32_t *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static uint16_t ck_pr_faa_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "xaddw" " %1, %0" : "+m" (*(uint16_t *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
__attribute__((unused)) static uint8_t ck_pr_faa_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "xaddb" " %1, %0" : "+m" (*(uint8_t *)target), "+q" (d) : : "memory", "cc");
    return (d);
}
# 332 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_inc_ptr(void *target)
{
    __asm__ __volatile__("lock " "inc" "q" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_ptr_zero(void *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "q" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_char(char *target)
{
    __asm__ __volatile__("lock " "inc" "b" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_char_zero(char *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "b" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_int(int *target)
{
    __asm__ __volatile__("lock " "inc" "l" " %0" : "+m" (*(int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_int_zero(int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "l" " %0; setz %1" : "+m" (*(int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_uint(unsigned int *target)
{
    __asm__ __volatile__("lock " "inc" "l" " %0" : "+m" (*(unsigned int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_uint_zero(unsigned int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "l" " %0; setz %1" : "+m" (*(unsigned int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_64(uint64_t *target)
{
    __asm__ __volatile__("lock " "inc" "q" " %0" : "+m" (*(uint64_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_64_zero(uint64_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "q" " %0; setz %1" : "+m" (*(uint64_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_32(uint32_t *target)
{
    __asm__ __volatile__("lock " "inc" "l" " %0" : "+m" (*(uint32_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_32_zero(uint32_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "l" " %0; setz %1" : "+m" (*(uint32_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_16(uint16_t *target)
{
    __asm__ __volatile__("lock " "inc" "w" " %0" : "+m" (*(uint16_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_16_zero(uint16_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "w" " %0; setz %1" : "+m" (*(uint16_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_8(uint8_t *target)
{
    __asm__ __volatile__("lock " "inc" "b" " %0" : "+m" (*(uint8_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_inc_8_zero(uint8_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "inc" "b" " %0; setz %1" : "+m" (*(uint8_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_ptr(void *target)
{
    __asm__ __volatile__("lock " "dec" "q" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_ptr_zero(void *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "q" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_char(char *target)
{
    __asm__ __volatile__("lock " "dec" "b" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_char_zero(char *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "b" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_int(int *target)
{
    __asm__ __volatile__("lock " "dec" "l" " %0" : "+m" (*(int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_int_zero(int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "l" " %0; setz %1" : "+m" (*(int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_uint(unsigned int *target)
{
    __asm__ __volatile__("lock " "dec" "l" " %0" : "+m" (*(unsigned int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_uint_zero(unsigned int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "l" " %0; setz %1" : "+m" (*(unsigned int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_64(uint64_t *target)
{
    __asm__ __volatile__("lock " "dec" "q" " %0" : "+m" (*(uint64_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_64_zero(uint64_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "q" " %0; setz %1" : "+m" (*(uint64_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_32(uint32_t *target)
{
    __asm__ __volatile__("lock " "dec" "l" " %0" : "+m" (*(uint32_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_32_zero(uint32_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "l" " %0; setz %1" : "+m" (*(uint32_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_16(uint16_t *target)
{
    __asm__ __volatile__("lock " "dec" "w" " %0" : "+m" (*(uint16_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_16_zero(uint16_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "w" " %0; setz %1" : "+m" (*(uint16_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_8(uint8_t *target)
{
    __asm__ __volatile__("lock " "dec" "b" " %0" : "+m" (*(uint8_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_dec_8_zero(uint8_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "dec" "b" " %0; setz %1" : "+m" (*(uint8_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_ptr(void *target)
{
    __asm__ __volatile__("lock " "neg" "q" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_ptr_zero(void *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "q" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_char(char *target)
{
    __asm__ __volatile__("lock " "neg" "b" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_char_zero(char *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "b" " %0; setz %1" : "+m" (*(char *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_int(int *target)
{
    __asm__ __volatile__("lock " "neg" "l" " %0" : "+m" (*(int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_int_zero(int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "l" " %0; setz %1" : "+m" (*(int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_uint(unsigned int *target)
{
    __asm__ __volatile__("lock " "neg" "l" " %0" : "+m" (*(unsigned int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_uint_zero(unsigned int *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "l" " %0; setz %1" : "+m" (*(unsigned int *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_64(uint64_t *target)
{
    __asm__ __volatile__("lock " "neg" "q" " %0" : "+m" (*(uint64_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_64_zero(uint64_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "q" " %0; setz %1" : "+m" (*(uint64_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_32(uint32_t *target)
{
    __asm__ __volatile__("lock " "neg" "l" " %0" : "+m" (*(uint32_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_32_zero(uint32_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "l" " %0; setz %1" : "+m" (*(uint32_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_16(uint16_t *target)
{
    __asm__ __volatile__("lock " "neg" "w" " %0" : "+m" (*(uint16_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_16_zero(uint16_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "w" " %0; setz %1" : "+m" (*(uint16_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_8(uint8_t *target)
{
    __asm__ __volatile__("lock " "neg" "b" " %0" : "+m" (*(uint8_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_neg_8_zero(uint8_t *target, _Bool *r)
{
    __asm__ __volatile__("lock " "neg" "b" " %0; setz %1" : "+m" (*(uint8_t *)target), "=m" (*r) : : "memory", "cc");
    return;
}




__attribute__((unused)) static void ck_pr_not_ptr(void *target)
{
    __asm__ __volatile__("lock " "not" "q" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_char(char *target)
{
    __asm__ __volatile__("lock " "not" "b" " %0" : "+m" (*(char *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_int(int *target)
{
    __asm__ __volatile__("lock " "not" "l" " %0" : "+m" (*(int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_uint(unsigned int *target)
{
    __asm__ __volatile__("lock " "not" "l" " %0" : "+m" (*(unsigned int *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_64(uint64_t *target)
{
    __asm__ __volatile__("lock " "not" "q" " %0" : "+m" (*(uint64_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_32(uint32_t *target)
{
    __asm__ __volatile__("lock " "not" "l" " %0" : "+m" (*(uint32_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_16(uint16_t *target)
{
    __asm__ __volatile__("lock " "not" "w" " %0" : "+m" (*(uint16_t *)target) : : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_not_8(uint8_t *target)
{
    __asm__ __volatile__("lock " "not" "b" " %0" : "+m" (*(uint8_t *)target) : : "memory", "cc");
    return;
}
# 373 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_add_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "add" "q" " %1, %0" : "+m" (*(char *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_char(char *target, char d)
{
    __asm__ __volatile__("lock " "add" "b" " %1, %0" : "+m" (*(char *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_int(int *target, int d)
{
    __asm__ __volatile__("lock " "add" "l" " %1, %0" : "+m" (*(int *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "add" "l" " %1, %0" : "+m" (*(unsigned int *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "add" "q" " %1, %0" : "+m" (*(uint64_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "add" "l" " %1, %0" : "+m" (*(uint32_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "add" "w" " %1, %0" : "+m" (*(uint16_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_add_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "add" "b" " %1, %0" : "+m" (*(uint8_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "sub" "q" " %1, %0" : "+m" (*(char *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_char(char *target, char d)
{
    __asm__ __volatile__("lock " "sub" "b" " %1, %0" : "+m" (*(char *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_int(int *target, int d)
{
    __asm__ __volatile__("lock " "sub" "l" " %1, %0" : "+m" (*(int *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "sub" "l" " %1, %0" : "+m" (*(unsigned int *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "sub" "q" " %1, %0" : "+m" (*(uint64_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "sub" "l" " %1, %0" : "+m" (*(uint32_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "sub" "w" " %1, %0" : "+m" (*(uint16_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_sub_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "sub" "b" " %1, %0" : "+m" (*(uint8_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "and" "q" " %1, %0" : "+m" (*(char *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_char(char *target, char d)
{
    __asm__ __volatile__("lock " "and" "b" " %1, %0" : "+m" (*(char *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_int(int *target, int d)
{
    __asm__ __volatile__("lock " "and" "l" " %1, %0" : "+m" (*(int *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "and" "l" " %1, %0" : "+m" (*(unsigned int *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "and" "q" " %1, %0" : "+m" (*(uint64_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "and" "l" " %1, %0" : "+m" (*(uint32_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "and" "w" " %1, %0" : "+m" (*(uint16_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_and_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "and" "b" " %1, %0" : "+m" (*(uint8_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "or" "q" " %1, %0" : "+m" (*(char *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_char(char *target, char d)
{
    __asm__ __volatile__("lock " "or" "b" " %1, %0" : "+m" (*(char *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_int(int *target, int d)
{
    __asm__ __volatile__("lock " "or" "l" " %1, %0" : "+m" (*(int *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "or" "l" " %1, %0" : "+m" (*(unsigned int *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "or" "q" " %1, %0" : "+m" (*(uint64_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "or" "l" " %1, %0" : "+m" (*(uint32_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "or" "w" " %1, %0" : "+m" (*(uint16_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_or_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "or" "b" " %1, %0" : "+m" (*(uint8_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_ptr(void *target, uintptr_t d)
{
    __asm__ __volatile__("lock " "xor" "q" " %1, %0" : "+m" (*(char *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_char(char *target, char d)
{
    __asm__ __volatile__("lock " "xor" "b" " %1, %0" : "+m" (*(char *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_int(int *target, int d)
{
    __asm__ __volatile__("lock " "xor" "l" " %1, %0" : "+m" (*(int *)target) : "e" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_uint(unsigned int *target, unsigned int d)
{
    __asm__ __volatile__("lock " "xor" "l" " %1, %0" : "+m" (*(unsigned int *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_64(uint64_t *target, uint64_t d)
{
    __asm__ __volatile__("lock " "xor" "q" " %1, %0" : "+m" (*(uint64_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_32(uint32_t *target, uint32_t d)
{
    __asm__ __volatile__("lock " "xor" "l" " %1, %0" : "+m" (*(uint32_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_16(uint16_t *target, uint16_t d)
{
    __asm__ __volatile__("lock " "xor" "w" " %1, %0" : "+m" (*(uint16_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
__attribute__((unused)) static void ck_pr_xor_8(uint8_t *target, uint8_t d)
{
    __asm__ __volatile__("lock " "xor" "b" " %1, %0" : "+m" (*(uint8_t *)target) : "Z" "q" (d) : "memory", "cc");
    return;
}
# 400 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static _Bool ck_pr_cas_ptr(void *target, void * compare, void * set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgq" " %2, %0; setz %1" : "+m" (*(char *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}



__attribute__((unused)) static _Bool ck_pr_cas_char(char *target, char compare, char set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgb" " %2, %0; setz %1" : "+m" (*(char *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_int(int *target, int compare, int set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgl" " %2, %0; setz %1" : "+m" (*(int *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_uint(unsigned int *target, unsigned int compare, unsigned int set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgl" " %2, %0; setz %1" : "+m" (*(unsigned int *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_double(double *target, double compare, double set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgq" " %2, %0; setz %1" : "+m" (*(double *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_64(uint64_t *target, uint64_t compare, uint64_t set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgq" " %2, %0; setz %1" : "+m" (*(uint64_t *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_32(uint32_t *target, uint32_t compare, uint32_t set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgl" " %2, %0; setz %1" : "+m" (*(uint32_t *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_16(uint16_t *target, uint16_t compare, uint16_t set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgw" " %2, %0; setz %1" : "+m" (*(uint16_t *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_8(uint8_t *target, uint8_t compare, uint8_t set)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchgb" " %2, %0; setz %1" : "+m" (*(uint8_t *)target), "=a" (z) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
# 436 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static _Bool ck_pr_cas_ptr_value(void *target, void * compare, void * set, void *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "q" " %3, %0;" "mov %% " "rax" ", %2;" "setz %1;" : "+m" (*(char *)target), "=a" (z), "=m" (*(char *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}




__attribute__((unused)) static _Bool ck_pr_cas_char_value(char *target, char compare, char set, char *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "b" " %3, %0;" "mov %% " "al" ", %2;" "setz %1;" : "+m" (*(char *)target), "=a" (z), "=m" (*(char *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_int_value(int *target, int compare, int set, int *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "l" " %3, %0;" "mov %% " "eax" ", %2;" "setz %1;" : "+m" (*(int *)target), "=a" (z), "=m" (*(int *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_uint_value(unsigned int *target, unsigned int compare, unsigned int set, unsigned int *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "l" " %3, %0;" "mov %% " "eax" ", %2;" "setz %1;" : "+m" (*(unsigned int *)target), "=a" (z), "=m" (*(unsigned int *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_double_value(double *target, double compare, double set, double *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "q" " %3, %0;" "mov %% " "rax" ", %2;" "setz %1;" : "+m" (*(double *)target), "=a" (z), "=m" (*(double *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_64_value(uint64_t *target, uint64_t compare, uint64_t set, uint64_t *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "q" " %3, %0;" "mov %% " "rax" ", %2;" "setz %1;" : "+m" (*(uint64_t *)target), "=a" (z), "=m" (*(uint64_t *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_32_value(uint32_t *target, uint32_t compare, uint32_t set, uint32_t *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "l" " %3, %0;" "mov %% " "eax" ", %2;" "setz %1;" : "+m" (*(uint32_t *)target), "=a" (z), "=m" (*(uint32_t *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_16_value(uint16_t *target, uint16_t compare, uint16_t set, uint16_t *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "w" " %3, %0;" "mov %% " "ax" ", %2;" "setz %1;" : "+m" (*(uint16_t *)target), "=a" (z), "=m" (*(uint16_t *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}
__attribute__((unused)) static _Bool ck_pr_cas_8_value(uint8_t *target, uint8_t compare, uint8_t set, uint8_t *v)
{
    _Bool z;
    __asm__ __volatile__("lock " "cmpxchg" "b" " %3, %0;" "mov %% " "al" ", %2;" "setz %1;" : "+m" (*(uint8_t *)target), "=a" (z), "=m" (*(uint8_t *)v) : "q" (set), "a" (compare) : "memory", "cc");
    return z;
}







__attribute__((unused)) static _Bool
ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2])
{
    _Bool z;

    __asm__ __volatile__("movq 0(%4), %%rax;"
                         "movq 8(%4), %%rdx;"
                         "lock " "cmpxchg16b %0; setz %1"
                         : "+m" (*target),
                         "=q" (z)
                         : "b" (set[0]),
                         "c" (set[1]),
                         "q" (compare)
                         : "memory", "cc", "%rax", "%rdx");
    return z;
}

__attribute__((unused)) static _Bool
ck_pr_cas_ptr_2(void *t, void *c, void *s)
{
    return ck_pr_cas_64_2(t,
                          c,
                          s);
}

__attribute__((unused)) static _Bool
ck_pr_cas_64_2_value(uint64_t target[2],
                     uint64_t compare[2],
                     uint64_t set[2],
                     uint64_t v[2])
{
    _Bool z;

    __asm__ __volatile__("lock " "cmpxchg16b %0;"
                         "setz %3"
                         : "+m" (*target),
                         "=a" (v[0]),
                         "=d" (v[1]),
                         "=q" (z)
                         : "a" (compare[0]),
                         "d" (compare[1]),
                         "b" (set[0]),
                         "c" (set[1])
                         : "memory", "cc");
    return z;
}

__attribute__((unused)) static _Bool
ck_pr_cas_ptr_2_value(void *t, void *c, void *s, void *v)
{
    return ck_pr_cas_64_2_value(t,
                                c,
                                s,
                                v);
}
# 529 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static _Bool ck_pr_cas_double_2(double t[2], double c[2], double s[2])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_double_2_value(double *t, double c[2], double s[2], double *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_char_16(char t[16], char c[16], char s[16])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_char_16_value(char *t, char c[16], char s[16], char *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_int_4(int t[4], int c[4], int s[4])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_int_4_value(int *t, int c[4], int s[4], int *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_uint_4(unsigned int t[4], unsigned int c[4], unsigned int s[4])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_uint_4_value(unsigned int *t, unsigned int c[4], unsigned int s[4], unsigned int *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_32_4(uint32_t t[4], uint32_t c[4], uint32_t s[4])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_32_4_value(uint32_t *t, uint32_t c[4], uint32_t s[4], uint32_t *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_16_8(uint16_t t[8], uint16_t c[8], uint16_t s[8])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_16_8_value(uint16_t *t, uint16_t c[8], uint16_t s[8], uint16_t *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
__attribute__((unused)) static _Bool ck_pr_cas_8_16(uint8_t t[16], uint8_t c[16], uint8_t s[16])
{
    return ck_pr_cas_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s);
}
__attribute__((unused)) static _Bool ck_pr_cas_8_16_value(uint8_t *t, uint8_t c[16], uint8_t s[16], uint8_t *v)
{
    return ck_pr_cas_64_2_value((uint64_t *)(void *)t, (uint64_t *)(void *)c, (uint64_t *)(void *)s, (uint64_t *)(void *)v);
}
# 565 "/usr/local/include/gcc/x86_64/ck_pr.h" 3
__attribute__((unused)) static _Bool ck_pr_btc_ptr(void *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "q %2, %0" "; setc %1" : "+m" (*(char *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btc_uint(unsigned int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "l %2, %0" "; setc %1" : "+m" (*(unsigned int *)target), "=q" (c) : "q" ((unsigned int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btc_int(int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "l %2, %0" "; setc %1" : "+m" (*(int *)target), "=q" (c) : "q" ((int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btc_64(uint64_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "q %2, %0" "; setc %1" : "+m" (*(uint64_t *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btc_32(uint32_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "l %2, %0" "; setc %1" : "+m" (*(uint32_t *)target), "=q" (c) : "q" ((uint32_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btc_16(uint16_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btc" "w %w2, %0" "; setc %1" : "+m" (*(uint16_t *)target), "=q" (c) : "q" ((uint16_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_ptr(void *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "q %2, %0" "; setc %1" : "+m" (*(char *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_uint(unsigned int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "l %2, %0" "; setc %1" : "+m" (*(unsigned int *)target), "=q" (c) : "q" ((unsigned int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_int(int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "l %2, %0" "; setc %1" : "+m" (*(int *)target), "=q" (c) : "q" ((int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_64(uint64_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "q %2, %0" "; setc %1" : "+m" (*(uint64_t *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_32(uint32_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "l %2, %0" "; setc %1" : "+m" (*(uint32_t *)target), "=q" (c) : "q" ((uint32_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_bts_16(uint16_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "bts" "w %w2, %0" "; setc %1" : "+m" (*(uint16_t *)target), "=q" (c) : "q" ((uint16_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_ptr(void *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "q %2, %0" "; setc %1" : "+m" (*(char *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_uint(unsigned int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "l %2, %0" "; setc %1" : "+m" (*(unsigned int *)target), "=q" (c) : "q" ((unsigned int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_int(int *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "l %2, %0" "; setc %1" : "+m" (*(int *)target), "=q" (c) : "q" ((int)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_64(uint64_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "q %2, %0" "; setc %1" : "+m" (*(uint64_t *)target), "=q" (c) : "q" ((uint64_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_32(uint32_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "l %2, %0" "; setc %1" : "+m" (*(uint32_t *)target), "=q" (c) : "q" ((uint32_t)b) : "memory", "cc");
    return c;
}
__attribute__((unused)) static _Bool ck_pr_btr_16(uint16_t *target, unsigned int b)
{
    _Bool c;
    __asm__ __volatile__("lock " "btr" "w %w2, %0" "; setc %1" : "+m" (*(uint16_t *)target), "=q" (c) : "q" ((uint16_t)b) : "memory", "cc");
    return c;
}
# 40 "/usr/local/include/ck_pr.h" 2 3
# 56 "/usr/local/include/ck_pr.h" 3
# 1 "/usr/local/include/gcc/ck_pr.h" 1 3
# 36 "/usr/local/include/gcc/ck_pr.h" 3
__attribute__((unused)) static void
ck_pr_barrier(void)
{

    __asm__ __volatile__("" ::: "memory");
    return;
}
# 57 "/usr/local/include/ck_pr.h" 2 3
# 78 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_fence_load_depends(void)
{
    ck_pr_barrier();
    return;
}
# 128 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_fence_atomic(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_atomic_load(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_atomic_store(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_store_atomic(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_load_atomic(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_load_store(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_store_load(void)
{
    ck_pr_fence_strict_store_load();
    return;
}
__attribute__((unused)) static void ck_pr_fence_load(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_store(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_memory(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_acquire(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_release(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_lock(void)
{
    ck_pr_barrier();
    return;
}
__attribute__((unused)) static void ck_pr_fence_unlock(void)
{
    ck_pr_barrier();
    return;
}
# 277 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_add_double(double *target, double value)
{
    double previous;
    double punt;
    punt = ck_pr_md_load_double(target);
    previous = (double)punt;
    while (ck_pr_cas_double_value(target, (double)previous, (double)(previous + value), &previous) == 0) ck_pr_stall();
    return;
}




__attribute__((unused)) static void ck_pr_sub_double(double *target, double value)
{
    double previous;
    double punt;
    punt = ck_pr_md_load_double(target);
    previous = (double)punt;
    while (ck_pr_cas_double_value(target, (double)previous, (double)(previous - value), &previous) == 0) ck_pr_stall();
    return;
}
# 677 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_inc_double(double *target)
{
    ck_pr_add_double(target, (double)1);
    return;
}




__attribute__((unused)) static void ck_pr_dec_double(double *target)
{
    ck_pr_sub_double(target, (double)1);
    return;
}
# 916 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static void ck_pr_neg_double(double *target)
{
    double previous;
    double punt;
    punt = (double)ck_pr_md_load_double(target);
    previous = (double)punt;
    while (ck_pr_cas_double_value(target, (double)previous, (double)(- previous), &previous) == 0) ck_pr_stall();
    return;
}
# 1107 "/usr/local/include/ck_pr.h" 3
__attribute__((unused)) static double ck_pr_faa_double(double *target, double delta)
{
    double previous;
    double punt;
    punt = (double)ck_pr_md_load_double(target);
    previous = (double)punt;
    while (ck_pr_cas_double_value(target, (double)previous, (double)(previous + delta), &previous) == 0) ck_pr_stall();
    return ((double)previous);
}
# 103 "rtapi/rtapi.h" 2









# 1 "rtapi/rtapi_global.h" 1
# 64 "rtapi/rtapi_global.h"
# 1 "rtapi/rtapi_shmkeys.h" 1
# 65 "rtapi/rtapi_global.h" 2
# 1 "rtapi/rtapi_bitops.h" 1
# 48 "rtapi/rtapi_bitops.h"
typedef unsigned long rtapi_atomic_type;
# 75 "rtapi/rtapi_bitops.h"
static inline int rtapi_test_and_set_bit(int nr, rtapi_atomic_type *bitmap)
{
    return (__atomic_fetch_or(bitmap + ((nr) / (8 * sizeof(rtapi_atomic_type))),
                              (1UL << ((nr) % (8 * sizeof(rtapi_atomic_type)))),
                              5)
            & (1UL << ((nr) % (8 * sizeof(rtapi_atomic_type))))) != 0;
}

static inline rtapi_atomic_type rtapi_test_and_clear_bit(int nr, rtapi_atomic_type * bitmap)
{
    return (__atomic_fetch_and(bitmap + ((nr) / (8 * sizeof(rtapi_atomic_type))),
                               ~(1UL << ((nr) % (8 * sizeof(rtapi_atomic_type)))),
                               5)
            & (1UL << ((nr) % (8 * sizeof(rtapi_atomic_type))))) != 0;
}

static inline void rtapi_set_bit(int nr, rtapi_atomic_type * bitmap)
{
    __atomic_or_fetch(bitmap + ((nr) / (8 * sizeof(rtapi_atomic_type))),
                      (1UL << ((nr) % (8 * sizeof(rtapi_atomic_type)))),
                      5);
}

static inline void rtapi_clear_bit(int nr, rtapi_atomic_type * bitmap)
{
    __atomic_and_fetch(bitmap + ((nr) / (8 * sizeof(rtapi_atomic_type))),
                       ~(1UL << ((nr) % (8 * sizeof(rtapi_atomic_type)))),
                       5);
}

static inline rtapi_atomic_type rtapi_test_bit(int nr, rtapi_atomic_type * const bitmap)
{
    return (__atomic_fetch_or(bitmap + ((nr) / (8 * sizeof(rtapi_atomic_type))),
                              0,
                              5)
            & (1UL << ((nr) % (8 * sizeof(rtapi_atomic_type))))) != 0;
}

static inline rtapi_atomic_type rtapi_add_and_fetch(int delta,
        rtapi_atomic_type * const value)
{
    return __atomic_add_fetch (value, delta, 5);
}

static inline rtapi_atomic_type rtapi_subtract_and_fetch(int delta,
        rtapi_atomic_type * const value)
{
    return __atomic_sub_fetch (value, delta, 5);
}
# 66 "rtapi/rtapi_global.h" 2
# 1 "rtapi/rtapi_exception.h" 1
# 22 "rtapi/rtapi_exception.h"
typedef void * exc_register_t;




typedef enum {
    RTAPI_EXCEPTION_NONE=0,


    RTAI_RTE_TMROVRN,

    RTAI_RTE_UNBLKD,
    RTAI_RTE_UNCLASSIFIED,
    RTAI_TRAP,


    XK_TRAP,
    XK_TRAP_BUG,
    XK_ETIMEDOUT,

    XK_EWOULDBLOCK,
    XK_EINTR,
    XK_EPERM,
    XK_UNDOCUMENTED,


    XU_SIGXCPU,
    XU_SIGXCPU_BUG,
    XU_ETIMEDOUT,
    XU_EWOULDBLOCK,
    XU_EINTR,
    XU_EPERM,
    XU_UNDOCUMENTED,


    RTP_DEADLINE_MISSED,

    RTAPI_EXCEPTION_LAST,

} rtapi_exception_t;
# 74 "rtapi/rtapi_exception.h"
typedef struct {

    int trap_errors;



    int modeswitches;
    int ctxswitches;
    int pagefaults;
    long long exectime;
    unsigned status;



    int wait_errors;
    int total_overruns;




} xenomai_stats_t;

typedef struct {
    int wait_errors;
} rtai_stats_t;

typedef struct {

    int wait_errors;


    long utime_sec;
    long utime_usec;

    long stime_sec;
    long stime_usec;

    long ru_minflt;
    long ru_majflt;
    long ru_nsignals;
    long ru_nivcsw;

    long startup_ru_minflt;
    long startup_ru_majflt;
    long startup_ru_nivcsw;

} rtprempt_stats_t;



typedef struct {

    int num_updates;






    int api_errors;
    int other_errors;


    union {
        xenomai_stats_t xeno;
        rtai_stats_t rtai;
        rtprempt_stats_t rtpreempt;
    } flavor;
} rtapi_threadstatus_t;




typedef struct {

    unsigned event;
    unsigned domid;
    exc_register_t ip;
    exc_register_t sp;
    int pid;
    int errcode;


    unsigned long overruns;


    void *siginfo;

} xenomai_exception_t;

typedef struct {

    unsigned vector;
    int signo;
    exc_register_t ip;

} rtai_exception_t;

typedef struct {


    void *siginfo;
} rtpreempt_exception_t;




typedef struct {
    int task_id;
    int error_code;


    union {

        xenomai_exception_t xeno;

        rtai_exception_t rtai;


        rtpreempt_exception_t rtpreempt;
    } flavor;
} rtapi_exception_detail_t;
# 206 "rtapi/rtapi_exception.h"
typedef int (*rtapi_exception_handler_t) (rtapi_exception_t type,


        rtapi_exception_detail_t *,
        rtapi_threadstatus_t *);
# 67 "rtapi/rtapi_global.h" 2
# 1 "rtapi/ring.h" 1
# 65 "rtapi/ring.h"
# 1 "rtapi/rtapi_mbarrier.h" 1
# 66 "rtapi/ring.h" 2
# 1 "rtapi/rtapi_string.h" 1
# 39 "rtapi/rtapi_string.h"
# 1 "/usr/include/string.h" 1 3 4
# 27 "/usr/include/string.h" 3 4





# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 33 "/usr/include/string.h" 2 3 4
# 44 "/usr/include/string.h" 3 4


extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
                     size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));


extern void *memmove (void *__dest, const void *__src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));






extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
                      int __c, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));





extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));


extern int memcmp (const void *__s1, const void *__s2, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
# 96 "/usr/include/string.h" 3 4
extern void *memchr (const void *__s, int __c, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));


# 110 "/usr/include/string.h" 3 4
extern void *rawmemchr (const void *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
# 121 "/usr/include/string.h" 3 4
extern void *memrchr (const void *__s, int __c, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));






extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));

extern char *strncpy (char *__restrict __dest,
                      const char *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));


extern char *strcat (char *__restrict __dest, const char *__restrict __src)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));

extern char *strncat (char *__restrict __dest, const char *__restrict __src,
                      size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));


extern int strcmp (const char *__s1, const char *__s2)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

extern int strncmp (const char *__s1, const char *__s2, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern int strcoll (const char *__s1, const char *__s2)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

extern size_t strxfrm (char *__restrict __dest,
                       const char *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));






# 1 "/usr/include/xlocale.h" 1 3 4
# 27 "/usr/include/xlocale.h" 3 4
typedef struct __locale_struct {

    struct __locale_data *__locales[13];


    const unsigned short int *__ctype_b;
    const int *__ctype_tolower;
    const int *__ctype_toupper;


    const char *__names[13];
} *__locale_t;


typedef __locale_t locale_t;
# 164 "/usr/include/string.h" 2 3 4


extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));

extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
                         __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));





extern char *strdup (const char *__s)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));






extern char *strndup (const char *__string, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
# 211 "/usr/include/string.h" 3 4

# 236 "/usr/include/string.h" 3 4
extern char *strchr (const char *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
# 263 "/usr/include/string.h" 3 4
extern char *strrchr (const char *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));


# 277 "/usr/include/string.h" 3 4
extern char *strchrnul (const char *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));






extern size_t strcspn (const char *__s, const char *__reject)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern size_t strspn (const char *__s, const char *__accept)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
# 315 "/usr/include/string.h" 3 4
extern char *strpbrk (const char *__s, const char *__accept)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
# 342 "/usr/include/string.h" 3 4
extern char *strstr (const char *__haystack, const char *__needle)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));




extern char *strtok (char *__restrict __s, const char *__restrict __delim)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));




extern char *__strtok_r (char *__restrict __s,
                         const char *__restrict __delim,
                         char **__restrict __save_ptr)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));

extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
                       char **__restrict __save_ptr)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
# 373 "/usr/include/string.h" 3 4
extern char *strcasestr (const char *__haystack, const char *__needle)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));







extern void *memmem (const void *__haystack, size_t __haystacklen,
                     const void *__needle, size_t __needlelen)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3)));



extern void *__mempcpy (void *__restrict __dest,
                        const void *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
extern void *mempcpy (void *__restrict __dest,
                      const void *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));





extern size_t strlen (const char *__s)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));





extern size_t strnlen (const char *__string, size_t __maxlen)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));





extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__));

# 438 "/usr/include/string.h" 3 4
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ;





extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__));





extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));



extern void bcopy (const void *__src, void *__dest, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));


extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));


extern int bcmp (const void *__s1, const void *__s2, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
# 489 "/usr/include/string.h" 3 4
extern char *index (const char *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
# 517 "/usr/include/string.h" 3 4
extern char *rindex (const char *__s, int __c)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));




extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));




extern int ffsl (long int __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
__extension__ extern int ffsll (long long int __ll)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));



extern int strcasecmp (const char *__s1, const char *__s2)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));





extern int strcasecmp_l (const char *__s1, const char *__s2,
                         __locale_t __loc)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));

extern int strncasecmp_l (const char *__s1, const char *__s2,
                          size_t __n, __locale_t __loc)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4)));





extern char *strsep (char **__restrict __stringp,
                     const char *__restrict __delim)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));




extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__));


extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));



extern char *__stpncpy (char *__restrict __dest,
                        const char *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
extern char *stpncpy (char *__restrict __dest,
                      const char *__restrict __src, size_t __n)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));




extern int strverscmp (const char *__s1, const char *__s2)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern char *strfry (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));


extern void *memfrob (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
# 604 "/usr/include/string.h" 3 4
extern char *basename (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
# 644 "/usr/include/string.h" 3 4

# 40 "rtapi/rtapi_string.h" 2
# 67 "rtapi/ring.h" 2







typedef __s32 ring_size_t;

typedef struct {
    size_t tail __attribute__((aligned(16)));
    __u8 scratchpad_buf[0];
} ringtrailer_t;







typedef enum {
    RINGTYPE_RECORD = 0,
    RINGTYPE_MULTIPART = (1UL << (0)),
    RINGTYPE_STREAM = (1UL << (1)),
    RINGTYPE_ANY = ((1UL << (0))|(1UL << (1))),
    RINGTYPE_MASK = ((1UL << (0))|(1UL << (1)))
} ring_type_t;



typedef enum {
    USE_RMUTEX = (1UL << (2)),
    USE_WMUTEX = (1UL << (3)),
    ALLOC_HALMEM = (1UL << (4)),
} ring_mode_flags_t;

typedef struct {
    __u8 type : 2;
    __u8 use_rmutex : 1;
    __u8 use_wmutex : 1;






    __u8 alloc_halmem : 1;

    __u32 userflags : 27;

    __s32 refcount;
    __s32 reader, writer;
    __s32 reader_instance, writer_instance;
    rtapi_atomic_type rmutex, wmutex;
    size_t trailer_size;
    size_t size_mask;
    size_t size;
    size_t head __attribute__((aligned(16)));
    __u64 generation;
    __u8 buf[0];
} ringheader_t;
# 137 "rtapi/ring.h"
typedef struct {
    __s32 magic;
    ringheader_t *header;
    ringtrailer_t *trailer;
    __u8 *buf;
    void *scratchpad;
} ringbuffer_t;

static inline int ringbuffer_attached(ringbuffer_t *rb)
{
    return (rb->magic == 0x74737769);
}


typedef struct {
    const ringbuffer_t *ring;
    __u64 generation;
    size_t offset;
} ringiter_t;

typedef struct {
    const void *rv_base;
    size_t rv_len;
    __u32 rv_flags;
} ringvec_t;
# 171 "rtapi/ring.h"
static inline ring_size_t size_aligned(const ring_size_t x)
{
    return x + (-x & (8 - 1));
}



static unsigned inline next_power_of_two(unsigned v)
{
    v--;
    v |= v >> 1;
    v |= v >> 2;
    v |= v >> 4;
    v |= v >> 8;
    v |= v >> 16;
    v++;
    return v;
}

static inline size_t ring_storage_alloc(int flags, size_t size)
{
    if ((flags & RINGTYPE_MASK) == RINGTYPE_STREAM) {

        return next_power_of_two(size);
    } else {


        return size_aligned(size);
    }
}

static inline size_t ring_trailer_alloc(size_t sp_size)
{
    return size_aligned(sizeof(ringtrailer_t) + sp_size);
}



static inline size_t ring_memsize(int flags, size_t size, size_t sp_size)
{
    return sizeof(ringheader_t) +
           ring_storage_alloc(flags, size) +
           ring_trailer_alloc(sp_size);
}

static inline int ring_refcount(ringheader_t *ringheader)
{
    return ringheader->refcount;
}

static inline ringtrailer_t *_trailer_from_header(const ringheader_t *ringheader)
{
    return (ringtrailer_t *) ((char *)ringheader->buf + ringheader->size);
}

static inline size_t ring_scratchpad_size(ringbuffer_t *ring)
{
    return ring->header->trailer_size - sizeof(ringtrailer_t);
}




static inline void ringheader_init(ringheader_t *ringheader, int flags,
                                   size_t size, size_t sp_size)
{
    ringtrailer_t *t;






    ringheader->size = ring_storage_alloc(flags,size);
    ringheader->trailer_size = ring_trailer_alloc(sp_size);


    ringheader->rmutex = ringheader->wmutex = 0;
    ringheader->reader = ringheader->writer = 0;
    ringheader->reader_instance = ringheader->writer_instance = 0;
    ringheader->head = 0;
    t = _trailer_from_header(ringheader);
    t->tail = 0;
    ringheader->type = (flags & RINGTYPE_MASK);


    if (flags & RINGTYPE_STREAM) {
        ringheader->size_mask = ringheader->size -1;
    } else {
        ringheader->generation = 0;
    }
    ringheader->refcount = 1;
}





static inline void ringbuffer_init(ringheader_t *ringheader, ringbuffer_t *ring)
{

    ring->header = ringheader;
    ring->trailer = _trailer_from_header(ringheader);
    ring->buf = &ringheader->buf[0];



    if (ring_scratchpad_size(ring))
        ring->scratchpad = ring->trailer->scratchpad_buf;
    else
        ring->scratchpad = ((void *)0);
    ring->magic = 0x74737769;
}
# 300 "rtapi/ring.h"
static inline ring_size_t * _size_at(const ringbuffer_t *ring, const size_t off)
{
    return (ring_size_t *) (ring->buf + off);
}



static inline size_t record_usage(const size_t record_size)
{
    return size_aligned(record_size + sizeof(ring_size_t));
}
# 337 "rtapi/ring.h"
static inline int record_write_begin(ringbuffer_t *ring, void ** data, size_t sz)
{
    size_t free;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;
    size_t a = size_aligned(sz + sizeof(ring_size_t));


    if (a > h->size)
        return 34;

    free = (h->size + h->head - t->tail - 1) % h->size + 1;



    if (free <= a) return 11;


    if (t->tail + a > h->size) {


        if (h->head <= a)

            return 11;


        *data = _size_at(ring, 0) + 1;
        return 0;
    }

    *data = _size_at(ring, t->tail) + 1;
    return 0;
}
# 378 "rtapi/ring.h"
static inline int record_write_end(ringbuffer_t *ring, void * data, size_t sz)
{
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;

    size_t a = size_aligned(sz + sizeof(ring_size_t));


    if (data == _size_at(ring, 0) + 1) {


        *_size_at(ring, t->tail) = -1;
        t->tail = 0;
    }

    *_size_at(ring, t->tail) = sz;




    __sync_synchronize();

    t->tail = (t->tail + a) % h->size;

    return 0;
}
# 414 "rtapi/ring.h"
static inline int record_write(ringbuffer_t *ring, void * data, size_t sz)
{
    void * ptr;
    int r = record_write_begin(ring, &ptr, sz);
    if (r) return r;
    memmove(ptr, data, sz);
    return record_write_end(ring, ptr, sz);
}






static inline int _ring_read_at(const ringbuffer_t *ring, size_t offset,
                                const void **data, size_t *size)
{
    ring_size_t *sz;
    ringtrailer_t *t = ring->trailer;

    if (offset == t->tail)

        return 11;


    __sync_synchronize();

    sz = _size_at(ring, offset);
    if (*sz < 0)

        return _ring_read_at(ring, 0, data, size);


    *size = *sz;
    *data = sz + 1;
    return 0;
}
# 463 "rtapi/ring.h"
static inline int record_read(const ringbuffer_t *ring, const void **data, size_t *size)
{
    return _ring_read_at(ring, ring->header->head, data, size);
}






static inline const void *record_next(ringbuffer_t *ring)
{
    const void *data;
    size_t size;
    if (record_read(ring, &data, &size)) return 0;
    return data;
}
# 488 "rtapi/ring.h"
static inline ring_size_t record_next_size(ringbuffer_t *ring)
{
    const void *data;
    size_t size;
    if (record_read(ring, &data, &size)) return -1;
    return size;
}
# 507 "rtapi/ring.h"
static inline size_t record_write_space(const ringheader_t *h)
{
    int avail = 0;
    ringtrailer_t *t = _trailer_from_header(h);

    if (t->tail < h->head)
        avail = h->head - t->tail;
    else
        avail = (((h->head) > (h->size - t->tail))?(h->head):(h->size - t->tail));
    return (((0) > (avail - (2 * 8)))?(0):(avail - (2 * 8)));
}
# 529 "rtapi/ring.h"
static inline size_t record_space(size_t element)
{
    return size_aligned(element + sizeof(ring_size_t));
}



static inline ring_size_t _ring_shift_offset(const ringbuffer_t *ring, size_t offset)
{
    ring_size_t size;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;

    if (h->head == t->tail)
        return -1;




    __sync_synchronize();

    size = *_size_at(ring, offset);
    if (size < 0)
        return _ring_shift_offset(ring, 0);
    size = size_aligned(size + sizeof(ring_size_t));
    return (offset + size) % h->size;
}
# 578 "rtapi/ring.h"
static inline int record_shift(ringbuffer_t *ring)
{
    ring_size_t off = _ring_shift_offset(ring, ring->header->head);
    if (off < 0) return 11;
    ring->header->generation++;
    ring->header->head = off;
    return 0;
}





static inline int record_flush(ringbuffer_t *ring)
{
    int count = 0;

    while (!record_shift(ring))
        count++;
    return count;
}
# 629 "rtapi/ring.h"
static inline int record_iter_init(const ringbuffer_t *ring,
                                   ringiter_t *iter)
{
    iter->ring = ring;
    iter->generation = ring->header->generation;
    iter->offset = ring->header->head;
    if (ring->header->generation != iter->generation)
        return 11;
    return 0;
}

static inline int record_iter_invalid(const ringiter_t *iter)
{
    if (iter->ring->header->generation > iter->generation)
        return 22;
    return 0;
}

static inline int record_iter_shift(ringiter_t *iter)
{
    ring_size_t off;

    if (record_iter_invalid(iter)) return 22;
    off = _ring_shift_offset(iter->ring, iter->offset);
    if (off < 0) return 11;
    iter->generation++;
    iter->offset = off;
    return 0;
}

static inline int record_iter_read(const ringiter_t *iter,
                                   const void **data, size_t *size)
{
    if (record_iter_invalid(iter)) return 22;


    return _ring_read_at(iter->ring, iter->offset, data, size);
}



static inline int ring_isstream(ringbuffer_t *ring)
{
    return (ring->header->type == RINGTYPE_STREAM);
}

static inline int ring_ismultipart(ringbuffer_t *ring)
{
    return (ring->header->type == RINGTYPE_MULTIPART);
}


static inline int ring_use_wmutex(ringbuffer_t *ring)
{
    return ring->header->use_wmutex ;
}

static inline int ring_use_rmutex(ringbuffer_t *ring)
{
    return ring->header->use_rmutex;
}
# 789 "rtapi/ring.h"
static inline size_t stream_get_read_vector(const ringbuffer_t *ring,
        ringvec_t *vec)
{
    size_t free_cnt;
    size_t cnt2;
    size_t w, r;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;

    w = t->tail;
    r = h->head;

    if (w > r) {
        free_cnt = w - r;
    } else {
        free_cnt = (w - r + h->size) & h->size_mask;
    }
    cnt2 = r + free_cnt;
    if (cnt2 > h->size) {


        vec[0].rv_base = (void *) &(ring->buf[r]);
        vec[0].rv_len = h->size - r;
        vec[1].rv_base = (void *) ring->buf;
        vec[1].rv_len = cnt2 & h->size_mask;

    } else {

        vec[0].rv_base = (void *) &(ring->buf[r]);
        vec[0].rv_len = free_cnt;
        vec[1].rv_len = 0;
        vec[1].rv_base = ((void *)0);
    }
    return vec[0].rv_len + vec[1].rv_len;
}






static inline void stream_get_write_vector(const ringbuffer_t *ring,
        ringvec_t *vec)
{
    size_t free_cnt;
    size_t cnt2;
    size_t w, r;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;

    w = t->tail;
    r = h->head;

    if (w > r) {
        free_cnt = ((r - w + h->size) & h->size_mask) - 1;
    } else if (w < r) {
        free_cnt = (r - w) - 1;
    } else {
        free_cnt = h->size - 1;
    }
    cnt2 = w + free_cnt;
    if (cnt2 > h->size) {


        vec[0].rv_base = (void *) &(ring->buf[w]);
        vec[0].rv_len = h->size - w;
        vec[1].rv_base = (void *) ring->buf;
        vec[1].rv_len = cnt2 & h->size_mask;
    } else {
        vec[0].rv_base = (void *) &(ring->buf[w]);
        vec[0].rv_len = free_cnt;
        vec[1].rv_len = 0;
    }
    if (free_cnt)
        __sync_synchronize();
}






static inline size_t stream_read_space(const ringheader_t *h)
{
    size_t w, r;
    ringtrailer_t *t = _trailer_from_header(h);

    w = t->tail;
    r = h->head;
    if (w > r) {
        return w - r;
    } else {
        return (w - r + h->size) & h->size_mask;
    }
}




static inline size_t stream_read(ringbuffer_t *ring, char *dest, size_t cnt)
{
    size_t free_cnt;
    size_t cnt2;
    size_t to_read;
    size_t n1, n2;
    ringheader_t *h = ring->header;

    if ((free_cnt = stream_read_space (h)) == 0) {
        return 0;
    }
    to_read = cnt > free_cnt ? free_cnt : cnt;
    cnt2 = h->head + to_read;
    if (cnt2 > h->size) {
        n1 = h->size - h->head;
        n2 = cnt2 & h->size_mask;
    } else {
        n1 = to_read;
        n2 = 0;
    }
    memcpy (dest, &(ring->buf[h->head]), n1);
    h->head = (h->head + n1) & h->size_mask;

    if (n2) {
        memcpy (dest + n1, &(ring->buf[h->head]), n2);
        h->head = (h->head + n2) & h->size_mask;
    }
    return to_read;
}






static inline size_t stream_peek(ringbuffer_t *ring, char *dest, size_t cnt)
{
    size_t free_cnt;
    size_t cnt2;
    size_t to_read;
    size_t n1, n2;
    size_t tmp_head;
    ringheader_t *h = ring->header;

    tmp_head = h->head;
    if ((free_cnt = stream_read_space (h)) == 0) {
        return 0;
    }
    to_read = cnt > free_cnt ? free_cnt : cnt;
    cnt2 = tmp_head + to_read;
    if (cnt2 > h->size) {
        n1 = h->size - tmp_head;
        n2 = cnt2 & h->size_mask;
    } else {
        n1 = to_read;
        n2 = 0;
    }
    memcpy (dest, &(ring->buf[tmp_head]), n1);
    tmp_head = (tmp_head + n1) & h->size_mask;

    if (n2) {
        memcpy (dest + n1, &(ring->buf[tmp_head]), n2);
    }
    return to_read;
}



static inline void stream_read_advance(ringbuffer_t *ring, size_t cnt)
{
    size_t tmp;
    ringheader_t *h = ring->header;





    __sync_synchronize();
    tmp = (h->head + cnt) & h->size_mask;
    h->head = tmp;
}






static inline size_t stream_flush(ringbuffer_t *ring)
{
    size_t left = stream_read_space(ring->header);
    if (left > 0)
        stream_read_advance(ring, left);
    return left;
}





static inline size_t stream_write_space(const ringheader_t *h)
{
    size_t w, r;
    ringtrailer_t *t = _trailer_from_header(h);

    w = t->tail;
    r = h->head;
    if (w > r) {
        return ((r - w + h->size) & h->size_mask) - 1;
    } else if (w < r) {
        return (r - w) - 1;
    } else {
        return h->size - 1;
    }
}




static inline size_t stream_write(ringbuffer_t *ring, const char *src,
                                  size_t cnt)
{
    size_t free_cnt;
    size_t cnt2;
    size_t to_write;
    size_t n1, n2;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;

    if ((free_cnt = stream_write_space (h)) == 0) {
        return 0;
    }
    to_write = cnt > free_cnt ? free_cnt : cnt;
    cnt2 = t->tail + to_write;
    if (cnt2 > h->size) {
        n1 = h->size - t->tail;
        n2 = cnt2 & h->size_mask;
    } else {
        n1 = to_write;
        n2 = 0;
    }
    memcpy (&(ring->buf[t->tail]), src, n1);
    t->tail = (t->tail + n1) & h->size_mask;
    if (n2) {
        memcpy (&(ring->buf[t->tail]), src + n1, n2);
        t->tail = (t->tail + n2) & h->size_mask;
    }
    return to_write;
}


static inline void stream_write_advance(ringbuffer_t *ring, size_t cnt)
{
    size_t tmp;
    ringheader_t *h = ring->header;
    ringtrailer_t *t = ring->trailer;




    __sync_synchronize();
    tmp = (t->tail + cnt) & h->size_mask;
    t->tail = tmp;
}
# 68 "rtapi/rtapi_global.h" 2
# 1 "rtapi/rtapi_heap.h" 1
# 14 "rtapi/rtapi_heap.h"



# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h" 1 3 4
# 40 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 98 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 18 "rtapi/rtapi_heap.h" 2







struct rtapi_heap;
struct rtapi_heap_stat {
    size_t arena_size;
    size_t total_avail;
    size_t fragments;
    size_t largest;
    size_t requested;
    size_t allocated;
    size_t freed;
};

void *_rtapi_malloc_aligned(struct rtapi_heap *h, size_t nbytes, size_t align);
void *_rtapi_malloc(struct rtapi_heap *h, size_t nbytes);
void *_rtapi_calloc(struct rtapi_heap *h, size_t n, size_t size);
void *_rtapi_realloc(struct rtapi_heap *h, void *p, size_t size);
void _rtapi_free(struct rtapi_heap *h, void *p);
size_t _rtapi_allocsize(struct rtapi_heap *h, const void *ap);
int _rtapi_heap_init(struct rtapi_heap *h, const char *name);


int _rtapi_heap_addmem(struct rtapi_heap *h, void *space, size_t size);

int _rtapi_heap_setflags(struct rtapi_heap *heap, int flags);
size_t _rtapi_heap_status(struct rtapi_heap *h, struct rtapi_heap_stat *hs);


typedef void (*chunk_t)(size_t size, void *chunk, void *user);
size_t _rtapi_heap_walk_freelist(struct rtapi_heap *h, chunk_t cb, void *user);


# 69 "rtapi/rtapi_global.h" 2
# 1 "rtapi/rtapi_heap_private.h" 1



# 1 "rtapi/rtapi.h" 1
# 5 "rtapi/rtapi_heap_private.h" 2
# 28 "rtapi/rtapi_heap_private.h"
typedef struct rtapi_malloc_align {
    double _align[1];
} rtapi_malloc_align_t;





typedef struct rtapi_malloc_tag {
    uint32_t size : 24;
    uint32_t attr : 8;
} rtapi_malloc_tag_t;

union rtapi_malloc_header {
    struct hdr {
        uint32_t next;
        rtapi_malloc_tag_t tag;
    } s;
    rtapi_malloc_align_t align;
};

typedef union rtapi_malloc_header rtapi_malloc_hdr_t;

struct rtapi_heap {
    rtapi_malloc_hdr_t base;
    size_t free_p;
    size_t arena_size;
    rtapi_atomic_type mutex;
    int flags;
    size_t requested;
    size_t allocated;
    int freed;
    char name[16];
};

static inline void *heap_ptr(struct rtapi_heap *base, size_t offset)
{
    return ((unsigned char *)base + offset);
}

static inline size_t heap_off(struct rtapi_heap *base, void *p)
{
    return ((unsigned char *)p - (unsigned char *)base);
}
# 70 "rtapi/rtapi_global.h" 2






typedef struct {
    unsigned magic;
    int layout_version;
    unsigned long mutex;

    size_t global_segment_size;



    int instance_id;
    int rtapi_thread_flavor;


    int rt_msg_level;
    int user_msg_level;
    rtapi_atomic_type next_handle;
    int hal_size;
    int hal_thread_stack_size;





    int hal_descriptor_alignment;




    int hal_heap_flags;




    unsigned char service_uuid[16];

    int rtapi_app_pid;
    int rtapi_msgd_pid;


    rtapi_threadstatus_t thread_status[64 + 1];


    int error_ring_full;
    int error_ring_locked;




    int rtapi_messages_ptr;


    struct rtapi_heap heap;


    unsigned char arena[0] __attribute__((aligned((64))));

} global_data_t;

extern global_data_t *global_data;
# 113 "rtapi/rtapi.h" 2
# 1 "rtapi/rtapi_heap.h" 1
# 114 "rtapi/rtapi.h" 2
# 1 "rtapi/rtapi_exception.h" 1
# 115 "rtapi/rtapi.h" 2





# 137 "rtapi/rtapi.h"
static inline int is_aligned(const void *pointer, size_t byte_count)
{
    return (uintptr_t)pointer % byte_count == 0;
}
# 151 "rtapi/rtapi.h"
typedef __s32 shmoff_t;



static inline void *shm_ptr(const void *base, const shmoff_t offset)
{
    return ((char *)base + offset);
}
static inline shmoff_t shm_off(const void *base, const void *p)
{
    return ((char *)p - (char *)base);
}
# 181 "rtapi/rtapi.h"
typedef int (*rtapi_init_t)(const char *);


extern int _rtapi_init(const char *modname);
# 196 "rtapi/rtapi.h"
typedef int (*rtapi_exit_t)(int);


extern int _rtapi_exit(int module_id);




typedef int (*rtapi_next_handle_t)(void);


extern int _rtapi_next_handle(void);





typedef void * (*rtapi_malloc_t)(struct rtapi_heap *h, size_t nbytes);



typedef void * (*rtapi_malloc_aligned_t)(struct rtapi_heap *h,
        size_t nbytes,
        size_t align);



typedef void * (*rtapi_calloc_t)(struct rtapi_heap *h, size_t n, size_t size);



typedef void * (*rtapi_realloc_t)(struct rtapi_heap *h, void *p, size_t size);



typedef void (*rtapi_free_t)(struct rtapi_heap *h, void *p);



typedef size_t (*rtapi_allocsize_t)(struct rtapi_heap *h, const void *p);



typedef int (*rtapi_heap_init_t)(struct rtapi_heap *h, const char *name);




typedef int (*rtapi_heap_addmem_t)(struct rtapi_heap *h, void *space, size_t size);



typedef size_t (*rtapi_heap_status_t)(struct rtapi_heap *h, struct rtapi_heap_stat *hs);



typedef int (*rtapi_heap_setflags_t)(struct rtapi_heap *h, int flags);



typedef size_t (*rtapi_heap_walk_freelist_t)(struct rtapi_heap *h,
        chunk_t cb, void *user);
# 279 "rtapi/rtapi.h"
int rtapi_argvize(int avsize, char **av, char *s);
# 290 "rtapi/rtapi.h"
extern int rtapi_snprintf(char *buf, unsigned long int size,
                          const char *fmt, ...)
__attribute__((format(printf,3,4)));
# 303 "rtapi/rtapi.h"
extern int rtapi_vsnprintf(char *buf, unsigned long size,
                           const char *fmt, va_list ap);
# 319 "rtapi/rtapi.h"
extern void rtapi_print(const char *fmt, ...)
__attribute__((format(printf,1,2)));






typedef enum {
    RTAPI_MSG_NONE = 0,
    RTAPI_MSG_ERR,
    RTAPI_MSG_WARN,
    RTAPI_MSG_INFO,
    RTAPI_MSG_DBG,
    RTAPI_MSG_ALL
} msg_level_t;

extern void rtapi_print_msg(int level, const char *fmt, ...)
__attribute__((format(printf,2,3)));


void rtapi_print_loc(const int level,
                     const char *func,
                     const int line,
                     const char *topic,
                     const char *fmt, ...)
__attribute__((format(printf,5,6)));


const char *rtapi_last_msg(void);
# 417 "rtapi/rtapi.h"
extern int rtapi_set_msg_level(int level);


extern int rtapi_get_msg_level(void);
# 431 "rtapi/rtapi.h"
typedef void(*rtapi_msg_handler_t)(msg_level_t level, const char *fmt,
                                   va_list ap);


typedef void (*rtapi_set_msg_handler_t)(rtapi_msg_handler_t);

extern void rtapi_set_msg_handler(rtapi_msg_handler_t handler);

typedef rtapi_msg_handler_t (*rtapi_get_msg_handler_t)(void);

extern rtapi_msg_handler_t rtapi_get_msg_handler(void);

extern int rtapi_set_logtag(const char *fmt, ...);
extern const char *rtapi_get_logtag(void);

typedef enum {
    MSG_KERNEL = 0,
    MSG_RTUSER = 1,
    MSG_ULAPI = 2,
} msg_origin_t;



int vs_ringlogfv(const msg_level_t level,
                 const int pid,
                 const msg_origin_t origin,
                 const char *tag,
                 const char *format,
                 va_list ap);



typedef struct {
    msg_origin_t origin;
    int pid;
    int level;
    char tag[16];
    char buf[0];
} rtapi_msgheader_t;
# 480 "rtapi/rtapi.h"
# 1 "/usr/include/sched.h" 1 3 4
# 25 "/usr/include/sched.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4
# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4


typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;


typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

typedef signed long int __int64_t;
typedef unsigned long int __uint64_t;







typedef long int __quad_t;
typedef unsigned long int __u_quad_t;
# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4
# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4


typedef unsigned long int __dev_t;
typedef unsigned int __uid_t;
typedef unsigned int __gid_t;
typedef unsigned long int __ino_t;
typedef unsigned long int __ino64_t;
typedef unsigned int __mode_t;
typedef unsigned long int __nlink_t;
typedef long int __off_t;
typedef long int __off64_t;
typedef int __pid_t;
typedef struct {
    int __val[2];
} __fsid_t;
typedef long int __clock_t;
typedef unsigned long int __rlim_t;
typedef unsigned long int __rlim64_t;
typedef unsigned int __id_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;

typedef int __daddr_t;
typedef int __key_t;


typedef int __clockid_t;


typedef void * __timer_t;


typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef long int __blkcnt64_t;


typedef unsigned long int __fsblkcnt_t;
typedef unsigned long int __fsblkcnt64_t;


typedef unsigned long int __fsfilcnt_t;
typedef unsigned long int __fsfilcnt64_t;


typedef long int __fsword_t;

typedef long int __ssize_t;


typedef long int __syscall_slong_t;

typedef unsigned long int __syscall_ulong_t;



typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;


typedef long int __intptr_t;


typedef unsigned int __socklen_t;
# 26 "/usr/include/sched.h" 2 3 4


# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 29 "/usr/include/sched.h" 2 3 4



# 1 "/usr/include/time.h" 1 3 4
# 73 "/usr/include/time.h" 3 4


typedef __time_t time_t;



# 120 "/usr/include/time.h" 3 4
struct timespec {
    __time_t tv_sec;
    __syscall_slong_t tv_nsec;
};
# 33 "/usr/include/sched.h" 2 3 4


typedef __pid_t pid_t;





# 1 "/usr/include/x86_64-linux-gnu/bits/sched.h" 1 3 4
# 72 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4
struct sched_param {
    int __sched_priority;
};





extern int clone (int (*__fn) (void *__arg), void *__child_stack,
                  int __flags, void *__arg, ...) __attribute__ ((__nothrow__ , __leaf__));


extern int unshare (int __flags) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_getcpu (void) __attribute__ ((__nothrow__ , __leaf__));


extern int setns (int __fd, int __nstype) __attribute__ ((__nothrow__ , __leaf__));











struct __sched_param {
    int __sched_priority;
};
# 118 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4
typedef unsigned long int __cpu_mask;






typedef struct {
    __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
} cpu_set_t;
# 201 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4


extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
__attribute__ ((__nothrow__ , __leaf__));
extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));


# 42 "/usr/include/sched.h" 2 3 4







extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
__attribute__ ((__nothrow__ , __leaf__));


extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_setscheduler (__pid_t __pid, int __policy,
                               const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
# 116 "/usr/include/sched.h" 3 4
extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
                              const cpu_set_t *__cpuset) __attribute__ ((__nothrow__ , __leaf__));


extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
                              cpu_set_t *__cpuset) __attribute__ ((__nothrow__ , __leaf__));



# 481 "rtapi/rtapi.h" 2
# 498 "rtapi/rtapi.h"
static __inline__ void rtapi_mutex_give(unsigned long *mutex)
{
    rtapi_test_and_clear_bit(0, mutex);
}
# 510 "rtapi/rtapi.h"
static __inline__ int rtapi_mutex_try(unsigned long *mutex)
{
    return rtapi_test_and_set_bit(0, mutex);
}






static __inline__ void rtapi_mutex_get(unsigned long *mutex)
{
    while (rtapi_test_and_set_bit(0, mutex)) {



        sched_yield();

    }
}


struct _mutex_cleanup {
    int cond;
    rtapi_atomic_type *m;
};


static inline void _autorelease_mutex_if(struct _mutex_cleanup *c)
{
    if (c->cond)
        rtapi_mutex_give(c->m);
}
# 651 "rtapi/rtapi.h"
typedef long long int (*rtapi_get_time_t)(void);


extern long long int _rtapi_get_time(void);
# 681 "rtapi/rtapi.h"
typedef long long int (*rtapi_get_clocks_t)(void);


extern long long int _rtapi_get_clocks(void);
# 723 "rtapi/rtapi.h"
typedef void (*taskcode_t) (void*);

typedef enum {
    TF_NONRT = (1UL << (0)),
    TF_NOWAIT = (1UL << (1)),

} rtapi_thread_flags_t;


typedef struct {
    taskcode_t taskcode;
    void *arg;
    int prio;
    int owner;
    unsigned long int stacksize;
    int uses_fp;
    char *name;
    int cpu_id;
    rtapi_thread_flags_t flags;
} rtapi_task_args_t;


typedef int (*rtapi_prio_highest_lowest_t)(void);


extern int _rtapi_prio_highest(void);


extern int _rtapi_prio_lowest(void);

typedef int (*rtapi_prio_next_higher_lower_t)(int);


extern int _rtapi_prio_next_higher(int prio);


extern int _rtapi_prio_next_lower(int prio);
# 904 "rtapi/rtapi.h"
typedef int (*rtapi_shmem_new_t)(int, int, unsigned long int);


extern int _rtapi_shmem_new(int key, int module_id,
                            unsigned long int size);




typedef int (*rtapi_shmem_new_inst_t)(int, int, int, unsigned long int);


extern int _rtapi_shmem_new_inst(int key, int instance, int module_id,
                                 unsigned long int size);






typedef int (*rtapi_shmem_delete_t)(int, int);


extern int _rtapi_shmem_delete(int shmem_id, int module_id);

typedef int (*rtapi_shmem_delete_inst_t)(int, int, int);


extern int _rtapi_shmem_delete_inst(int shmem_id, int instance, int module_id);
# 941 "rtapi/rtapi.h"
typedef int (*rtapi_shmem_getptr_t)(int, void **, unsigned long int *);


extern int _rtapi_shmem_getptr(int shmem_id, void **ptr, unsigned long int *size);

typedef int (*rtapi_shmem_getptr_inst_t)(int, int, void **, unsigned long int *);


extern int _rtapi_shmem_getptr_inst(int shmem_id, int instance, void **ptr, unsigned long int *size);






typedef int (*rtapi_shmem_exists_t)(int);


extern int _rtapi_shmem_exists(int key);
# 972 "rtapi/rtapi.h"
typedef rtapi_exception_handler_t (*rtapi_set_exception_t) (rtapi_exception_handler_t);


extern rtapi_exception_handler_t _rtapi_set_exception(rtapi_exception_handler_t h);
# 984 "rtapi/rtapi.h"
# 1 "rtapi/rtapi_io.h" 1
# 39 "rtapi/rtapi_io.h"
# 1 "/usr/include/x86_64-linux-gnu/sys/io.h" 1 3 4
# 23 "/usr/include/x86_64-linux-gnu/sys/io.h" 3 4

# 32 "/usr/include/x86_64-linux-gnu/sys/io.h" 3 4
extern int ioperm (unsigned long int __from, unsigned long int __num,
                   int __turn_on) __attribute__ ((__nothrow__ , __leaf__));




extern int iopl (int __level) __attribute__ ((__nothrow__ , __leaf__));



static __inline unsigned char
inb (unsigned short int __port)
{
    unsigned char _v;

    __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline unsigned char
inb_p (unsigned short int __port)
{
    unsigned char _v;

    __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline unsigned short int
inw (unsigned short int __port)
{
    unsigned short _v;

    __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline unsigned short int
inw_p (unsigned short int __port)
{
    unsigned short int _v;

    __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline unsigned int
inl (unsigned short int __port)
{
    unsigned int _v;

    __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline unsigned int
inl_p (unsigned short int __port)
{
    unsigned int _v;
    __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
    return _v;
}

static __inline void
outb (unsigned char __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port));
}

static __inline void
outb_p (unsigned char __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value),
                          "Nd" (__port));
}

static __inline void
outw (unsigned short int __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port));

}

static __inline void
outw_p (unsigned short int __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value),
                          "Nd" (__port));
}

static __inline void
outl (unsigned int __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port));
}

static __inline void
outl_p (unsigned int __value, unsigned short int __port)
{
    __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value),
                          "Nd" (__port));
}

static __inline void
insb (unsigned short int __port, void *__addr, unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}

static __inline void
insw (unsigned short int __port, void *__addr, unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}

static __inline void
insl (unsigned short int __port, void *__addr, unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}

static __inline void
outsb (unsigned short int __port, const void *__addr,
       unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}

static __inline void
outsw (unsigned short int __port, const void *__addr,
       unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}

static __inline void
outsl (unsigned short int __port, const void *__addr,
       unsigned long int __count)
{
    __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count)
                          :"d" (__port), "0" (__addr), "1" (__count));
}




# 40 "rtapi/rtapi_io.h" 2
# 49 "rtapi/rtapi_io.h"
static inline void rtapi_outb(unsigned char byte, unsigned int port)
{
    outb(byte,port);
}






static inline unsigned char rtapi_inb(unsigned int port)
{
    return inb(port);
}





static inline void rtapi_outw(unsigned short word, unsigned int port)
{
    outw(word,port);
};





static inline unsigned short rtapi_inw(unsigned int port)
{
    return inw(port);
}
# 985 "rtapi/rtapi.h" 2
# 1034 "rtapi/rtapi.h"
typedef int (*rtapi_dummy_t)(void);

typedef struct {
    const char *git_version;
    const char *thread_flavor_name;
    int thread_flavor_id;
    unsigned long thread_flavor_flags;


    rtapi_init_t rtapi_init;
    rtapi_exit_t rtapi_exit;
    rtapi_next_handle_t rtapi_next_handle;






    rtapi_dummy_t rtapi_clock_set_period;
    rtapi_dummy_t rtapi_delay;
    rtapi_dummy_t rtapi_delay_max;

    rtapi_get_time_t rtapi_get_time;
    rtapi_get_clocks_t rtapi_get_clocks;

    rtapi_prio_highest_lowest_t rtapi_prio_highest;
    rtapi_prio_highest_lowest_t rtapi_prio_lowest;
    rtapi_prio_next_higher_lower_t rtapi_prio_next_higher;
    rtapi_prio_next_higher_lower_t rtapi_prio_next_lower;
# 1073 "rtapi/rtapi.h"
    rtapi_dummy_t rtapi_task_new;
    rtapi_dummy_t rtapi_task_delete;
    rtapi_dummy_t rtapi_task_start;
    rtapi_dummy_t rtapi_wait;
    rtapi_dummy_t rtapi_task_resume;
    rtapi_dummy_t rtapi_task_pause;
    rtapi_dummy_t rtapi_task_self;


    rtapi_shmem_new_t rtapi_shmem_new;
    rtapi_shmem_new_inst_t rtapi_shmem_new_inst;
    rtapi_shmem_delete_t rtapi_shmem_delete;
    rtapi_shmem_delete_inst_t rtapi_shmem_delete_inst;
    rtapi_shmem_getptr_t rtapi_shmem_getptr;
    rtapi_shmem_getptr_inst_t rtapi_shmem_getptr_inst;
    rtapi_shmem_exists_t rtapi_shmem_exists;




    rtapi_dummy_t rtapi_set_exception;




    rtapi_dummy_t rtapi_task_update_stats;

    rtapi_malloc_t rtapi_malloc;
    rtapi_malloc_aligned_t rtapi_malloc_aligned;
    rtapi_calloc_t rtapi_calloc;
    rtapi_realloc_t rtapi_realloc;
    rtapi_free_t rtapi_free;
    rtapi_allocsize_t rtapi_allocsize;
    rtapi_heap_init_t rtapi_heap_init;
    rtapi_heap_addmem_t rtapi_heap_addmem;
    rtapi_heap_status_t rtapi_heap_status;
    rtapi_heap_setflags_t rtapi_heap_setflags;
    rtapi_heap_walk_freelist_t rtapi_heap_walk_freelist;

} rtapi_switch_t;



extern rtapi_switch_t *rtapi_switch;





typedef rtapi_switch_t *(*rtapi_get_handle_t)(void);
extern rtapi_switch_t *rtapi_get_handle(void);
# 1132 "rtapi/rtapi.h"
extern void rtapi_autorelease_mutex(void *variable);



extern int rtapi_instance;
# 1145 "rtapi/rtapi.h"
typedef int (*ulapi_main_t)(int, int, global_data_t *);
typedef int (*ulapi_exit_t)(int);
extern int ulapi_main(int instance, int flavor, global_data_t *global);
extern int ulapi_exit(int instance);


extern void ulapi_cleanup(void);



extern void ulapi_kernel_compat_check(rtapi_switch_t *rtapi_switch,
                                      char *ulapi_lib);
extern int ulapi_loaded(void);
# 1357 "rtapi/rtapi.h"

# 5 "hal/lib/hal_accessor.h" 2


# 17 "hal/lib/hal_accessor.h"
static inline void *hal_ptr(const shmoff_t offset)
{
    return ((char *)hal_shmem_base + offset);
}
static inline shmoff_t hal_off(const void *p)
{
    return ((char *)p - (char *)hal_shmem_base);
}
static inline shmoff_t hal_off_safe(const void *p)
{
    if (p == ((void *)0)) return 0;
    return ((char *)p - (char *)hal_shmem_base);
}
# 57 "hal/lib/hal_accessor.h"
static inline const hal_bit_t set_bit_pin(bit_pin_ptr p, const hal_bit_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._bp);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    __atomic_store(&u->_b, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_s32_t set_s32_pin(s32_pin_ptr p, const hal_s32_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._sp);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    __atomic_store(&u->_s, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_u32_t set_u32_pin(u32_pin_ptr p, const hal_u32_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._up);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    __atomic_store(&u->_u, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_float_t set_float_pin(float_pin_ptr p, const hal_float_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._fp);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    __atomic_store(&u->_f, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return value;
}
# 79 "hal/lib/hal_accessor.h"
static inline const hal_bit_t get_bit_pin(const bit_pin_ptr p)
{
    const hal_pin_t *pin = (const hal_pin_t *)hal_ptr(p._bp);
    const hal_data_u *u = (const hal_data_u *)hal_ptr(pin->data_ptr);
    if (__builtin_expect(!!(hh_get_rmb(&pin->hdr)), 0)) __sync_synchronize();
    hal_bit_t rvalue ;
    __atomic_load(&u->_b, &rvalue , 5);
    return rvalue ;
}
static inline const hal_s32_t get_s32_pin(const s32_pin_ptr p)
{
    const hal_pin_t *pin = (const hal_pin_t *)hal_ptr(p._sp);
    const hal_data_u *u = (const hal_data_u *)hal_ptr(pin->data_ptr);
    if (__builtin_expect(!!(hh_get_rmb(&pin->hdr)), 0)) __sync_synchronize();
    hal_s32_t rvalue ;
    __atomic_load(&u->_s, &rvalue , 5);
    return rvalue ;
}
static inline const hal_u32_t get_u32_pin(const u32_pin_ptr p)
{
    const hal_pin_t *pin = (const hal_pin_t *)hal_ptr(p._up);
    const hal_data_u *u = (const hal_data_u *)hal_ptr(pin->data_ptr);
    if (__builtin_expect(!!(hh_get_rmb(&pin->hdr)), 0)) __sync_synchronize();
    hal_u32_t rvalue ;
    __atomic_load(&u->_u, &rvalue , 5);
    return rvalue ;
}
static inline const hal_float_t get_float_pin(const float_pin_ptr p)
{
    const hal_pin_t *pin = (const hal_pin_t *)hal_ptr(p._fp);
    const hal_data_u *u = (const hal_data_u *)hal_ptr(pin->data_ptr);
    if (__builtin_expect(!!(hh_get_rmb(&pin->hdr)), 0)) __sync_synchronize();
    hal_float_t rvalue ;
    __atomic_load(&u->_f, &rvalue , 5);
    return rvalue ;
}
# 101 "hal/lib/hal_accessor.h"
static inline const hal_s32_t incr_s32_pin(s32_pin_ptr p, const hal_s32_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._sp);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    hal_s32_t rvalue = __atomic_add_fetch(&u->_s, (value), 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return rvalue;
}
static inline const hal_u32_t incr_u32_pin(u32_pin_ptr p, const hal_u32_t value)
{
    hal_pin_t *pin = (hal_pin_t *)hal_ptr(p._up);
    hal_data_u *u = (hal_data_u *)hal_ptr(pin->data_ptr);
    hal_u32_t rvalue = __atomic_add_fetch(&u->_u, (value), 5);
    if (__builtin_expect(!!(hh_get_wmb(&pin->hdr)), 0)) __sync_synchronize();
    return rvalue;
}
# 121 "hal/lib/hal_accessor.h"
static inline const hal_bit_t get_bit_sig(const bit_sig_ptr p)
{
    const hal_sig_t *sig = (const hal_sig_t *)hal_ptr(p._bs);
    if (__builtin_expect(!!(hh_get_rmb(&sig->hdr)), 0)) __sync_synchronize();
    hal_bit_t rvalue ;
    __atomic_load(&sig->value._b, &rvalue , 5);
    return rvalue ;
}
static inline const hal_s32_t get_s32_sig(const s32_sig_ptr p)
{
    const hal_sig_t *sig = (const hal_sig_t *)hal_ptr(p._ss);
    if (__builtin_expect(!!(hh_get_rmb(&sig->hdr)), 0)) __sync_synchronize();
    hal_s32_t rvalue ;
    __atomic_load(&sig->value._s, &rvalue , 5);
    return rvalue ;
}
static inline const hal_u32_t get_u32_sig(const u32_sig_ptr p)
{
    const hal_sig_t *sig = (const hal_sig_t *)hal_ptr(p._us);
    if (__builtin_expect(!!(hh_get_rmb(&sig->hdr)), 0)) __sync_synchronize();
    hal_u32_t rvalue ;
    __atomic_load(&sig->value._u, &rvalue , 5);
    return rvalue ;
}
static inline const hal_float_t get_float_sig(const float_sig_ptr p)
{
    const hal_sig_t *sig = (const hal_sig_t *)hal_ptr(p._fs);
    if (__builtin_expect(!!(hh_get_rmb(&sig->hdr)), 0)) __sync_synchronize();
    hal_float_t rvalue ;
    __atomic_load(&sig->value._f, &rvalue , 5);
    return rvalue ;
}
# 143 "hal/lib/hal_accessor.h"
static inline const hal_bit_t set_bit_sig(bit_sig_ptr s, const hal_bit_t value)
{
    hal_sig_t *sig = (hal_sig_t *)hal_ptr(s._bs);
    __atomic_store(&sig->value._b, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&sig->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_s32_t set_s32_sig(s32_sig_ptr s, const hal_s32_t value)
{
    hal_sig_t *sig = (hal_sig_t *)hal_ptr(s._ss);
    __atomic_store(&sig->value._s, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&sig->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_u32_t set_u32_sig(u32_sig_ptr s, const hal_u32_t value)
{
    hal_sig_t *sig = (hal_sig_t *)hal_ptr(s._us);
    __atomic_store(&sig->value._u, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&sig->hdr)), 0)) __sync_synchronize();
    return value;
}
static inline const hal_float_t set_float_sig(float_sig_ptr s, const hal_float_t value)
{
    hal_sig_t *sig = (hal_sig_t *)hal_ptr(s._fs);
    __atomic_store(&sig->value._f, &value, 5);
    if (__builtin_expect(!!(hh_get_wmb(&sig->hdr)), 0)) __sync_synchronize();
    return value;
}




static inline _Bool bit_pin_null(const bit_pin_ptr b)
{
    return b._bp == 0;
}
static inline _Bool s32_pin_null(const s32_pin_ptr b)
{
    return b._sp == 0;
}
static inline _Bool u32_pin_null(const u32_pin_ptr b)
{
    return b._up == 0;
}
static inline _Bool float_pin_null(const float_pin_ptr b)
{
    return b._fp == 0;
}
static inline _Bool bit_sig_null(const bit_sig_ptr s)
{
    return s._bs == 0;
}
static inline _Bool s32_sig_null(const s32_sig_ptr s)
{
    return s._ss == 0;
}
static inline _Bool u32_sig_null(const u32_sig_ptr s)
{
    return s._us == 0;
}
static inline _Bool float_sig_null(const float_sig_ptr s)
{
    return s._fs == 0;
}



const char *hals_type(const hal_type_t type);

const char *hals_pindir(const hal_pin_dir_t dir);


bit_pin_ptr halx_pin_bit_newf(const hal_pin_dir_t dir,
                              const int owner_id,
                              const char *fmt, ...)
__attribute__((format(printf,3,4)));

float_pin_ptr halx_pin_float_newf(const hal_pin_dir_t dir,
                                  const int owner_id,
                                  const char *fmt, ...)
__attribute__((format(printf,3,4)));

u32_pin_ptr halx_pin_u32_newf(const hal_pin_dir_t dir,
                              const int owner_id,
                              const char *fmt, ...)
__attribute__((format(printf,3,4)));

s32_pin_ptr halx_pin_s32_newf(const hal_pin_dir_t dir,
                              const int owner_id,
                              const char *fmt, ...)
__attribute__((format(printf,3,4)));
# 216 "hal/lib/hal_accessor.h"
