#define asconst_RESULT 1584
#define asconst_TID 720
#define asconst_PID 724
#define asconst_CANCELHANDLING 776
#define asconst_CLEANUP_JMP_BUF 768
#define asconst_CLEANUP 760
#define asconst_CLEANUP_PREV 24
#define asconst_MUTEX_FUTEX 0
#define asconst_MULTIPLE_THREADS_OFFSET 24
#define asconst_POINTER_GUARD 48
#define asconst_VGETCPU_CACHE_OFFSET 56
#define asconst_PRIVATE_FUTEX 72
#define asconst_RTLD_SAVESPACE_SSE 128
#define asconst_TCB_CANCELSTATE_BITMASK 1
#define asconst_TCB_CANCELTYPE_BITMASK 2
#define asconst_TCB_CANCELING_BITMASK 4
#define asconst_TCB_CANCELED_BITMASK 8
#define asconst_TCB_EXITING_BITMASK 16
#define asconst_TCB_CANCEL_RESTMASK 4294967168
#define asconst_TCB_TERMINATED_BITMASK 32
#define asconst_TCB_PTHREAD_CANCELED -1
#include <sysdep.h>
#include <tls.h>

#include <inttypes.h>

#include <stdio.h>

#include <bits/wordsize.h>

#if __WORDSIZE == 64

typedef uint64_t c_t;

#define U(n) UINT64_C (n)

#define PRI PRId64

#else

typedef uint32_t c_t;

#define U(n) UINT32_C (n)

#define PRI PRId32

#endif

static int do_test (void)
{
  int bad = 0, good = 0;

#define TEST(name, source, expr) \
  if (U (asconst_##name) != (c_t) (expr)) { ++bad; fprintf (stderr, "%s: %s is %" PRI " but %s is %"PRI "\n", source, #name, U (asconst_##name), #expr, (c_t) (expr)); } else ++good;

  TEST (RESULT, "../nptl/sysdeps/x86_64/tcb-offsets.sym:4", offsetof (struct pthread, result))
  TEST (TID, "../nptl/sysdeps/x86_64/tcb-offsets.sym:5", offsetof (struct pthread, tid))
  TEST (PID, "../nptl/sysdeps/x86_64/tcb-offsets.sym:6", offsetof (struct pthread, pid))
  TEST (CANCELHANDLING, "../nptl/sysdeps/x86_64/tcb-offsets.sym:7", offsetof (struct pthread, cancelhandling))
  TEST (CLEANUP_JMP_BUF, "../nptl/sysdeps/x86_64/tcb-offsets.sym:8", offsetof (struct pthread, cleanup_jmp_buf))
  TEST (CLEANUP, "../nptl/sysdeps/x86_64/tcb-offsets.sym:9", offsetof (struct pthread, cleanup))
  TEST (CLEANUP_PREV, "../nptl/sysdeps/x86_64/tcb-offsets.sym:10", offsetof (struct _pthread_cleanup_buffer, __prev))
  TEST (MUTEX_FUTEX, "../nptl/sysdeps/x86_64/tcb-offsets.sym:11", offsetof (pthread_mutex_t, __data.__lock))
  TEST (MULTIPLE_THREADS_OFFSET, "../nptl/sysdeps/x86_64/tcb-offsets.sym:12", offsetof (tcbhead_t, multiple_threads))
  TEST (POINTER_GUARD, "../nptl/sysdeps/x86_64/tcb-offsets.sym:13", offsetof (tcbhead_t, pointer_guard))
  TEST (VGETCPU_CACHE_OFFSET, "../nptl/sysdeps/x86_64/tcb-offsets.sym:14", offsetof (tcbhead_t, vgetcpu_cache))
#ifndef __ASSUME_PRIVATE_FUTEX
  TEST (PRIVATE_FUTEX, "../nptl/sysdeps/x86_64/tcb-offsets.sym:16", offsetof (tcbhead_t, private_futex))
#endif
  TEST (RTLD_SAVESPACE_SSE, "../nptl/sysdeps/x86_64/tcb-offsets.sym:18", offsetof (tcbhead_t, rtld_savespace_sse))
  TEST (TCB_CANCELSTATE_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:21", CANCELSTATE_BITMASK)
  TEST (TCB_CANCELTYPE_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:22", CANCELTYPE_BITMASK)
  TEST (TCB_CANCELING_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:23", CANCELING_BITMASK)
  TEST (TCB_CANCELED_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:24", CANCELED_BITMASK)
  TEST (TCB_EXITING_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:25", EXITING_BITMASK)
  TEST (TCB_CANCEL_RESTMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:26", CANCEL_RESTMASK)
  TEST (TCB_TERMINATED_BITMASK, "../nptl/sysdeps/x86_64/tcb-offsets.sym:27", TERMINATED_BITMASK)
  TEST (TCB_PTHREAD_CANCELED, "../nptl/sysdeps/x86_64/tcb-offsets.sym:28", PTHREAD_CANCELED)
  printf ("%d errors in %d tests\n", bad, good + bad);
  return bad != 0 || good == 0;
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
