require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_STDATOMIC_H)) {
    eval 'sub _STDATOMIC_H () {1;}' unless defined(&_STDATOMIC_H);
    eval("sub memory_order_relaxed () { __ATOMIC_RELAXED; }") unless defined(&memory_order_relaxed);
    eval("sub memory_order_consume () { __ATOMIC_CONSUME; }") unless defined(&memory_order_consume);
    eval("sub memory_order_acquire () { __ATOMIC_ACQUIRE; }") unless defined(&memory_order_acquire);
    eval("sub memory_order_release () { __ATOMIC_RELEASE; }") unless defined(&memory_order_release);
    eval("sub memory_order_acq_rel () { __ATOMIC_ACQ_REL; }") unless defined(&memory_order_acq_rel);
    eval("sub memory_order_seq_cst () { __ATOMIC_SEQ_CST; }") unless defined(&memory_order_seq_cst);
    eval 'sub ATOMIC_VAR_INIT {
        my($VALUE) = @_;
	    eval q(($VALUE));
    }' unless defined(&ATOMIC_VAR_INIT);
    eval 'sub atomic_init {
        my($PTR, $VAL) = @_;
	    eval q( &atomic_store_explicit ($PTR, $VAL,  &__ATOMIC_RELAXED));
    }' unless defined(&atomic_init);
    eval 'sub kill_dependency {
        my($Y) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__kill_dependency_tmp = ($Y);  &__kill_dependency_tmp; }));
    }' unless defined(&kill_dependency);
    eval 'sub atomic_thread_fence {
        my($MO) = @_;
	    eval q( &__atomic_thread_fence ($MO));
    }' unless defined(&atomic_thread_fence);
    eval 'sub atomic_signal_fence {
        my($MO) = @_;
	    eval q( &__atomic_signal_fence ($MO));
    }' unless defined(&atomic_signal_fence);
    eval 'sub atomic_is_lock_free {
        my($OBJ) = @_;
	    eval q( &__atomic_is_lock_free ($sizeof{($OBJ)}, ($OBJ)));
    }' unless defined(&atomic_is_lock_free);
    eval 'sub ATOMIC_BOOL_LOCK_FREE () { &__GCC_ATOMIC_BOOL_LOCK_FREE;}' unless defined(&ATOMIC_BOOL_LOCK_FREE);
    eval 'sub ATOMIC_CHAR_LOCK_FREE () { &__GCC_ATOMIC_CHAR_LOCK_FREE;}' unless defined(&ATOMIC_CHAR_LOCK_FREE);
    eval 'sub ATOMIC_CHAR16_T_LOCK_FREE () { &__GCC_ATOMIC_CHAR16_T_LOCK_FREE;}' unless defined(&ATOMIC_CHAR16_T_LOCK_FREE);
    eval 'sub ATOMIC_CHAR32_T_LOCK_FREE () { &__GCC_ATOMIC_CHAR32_T_LOCK_FREE;}' unless defined(&ATOMIC_CHAR32_T_LOCK_FREE);
    eval 'sub ATOMIC_WCHAR_T_LOCK_FREE () { &__GCC_ATOMIC_WCHAR_T_LOCK_FREE;}' unless defined(&ATOMIC_WCHAR_T_LOCK_FREE);
    eval 'sub ATOMIC_SHORT_LOCK_FREE () { &__GCC_ATOMIC_SHORT_LOCK_FREE;}' unless defined(&ATOMIC_SHORT_LOCK_FREE);
    eval 'sub ATOMIC_INT_LOCK_FREE () { &__GCC_ATOMIC_INT_LOCK_FREE;}' unless defined(&ATOMIC_INT_LOCK_FREE);
    eval 'sub ATOMIC_LONG_LOCK_FREE () { &__GCC_ATOMIC_LONG_LOCK_FREE;}' unless defined(&ATOMIC_LONG_LOCK_FREE);
    eval 'sub ATOMIC_LLONG_LOCK_FREE () { &__GCC_ATOMIC_LLONG_LOCK_FREE;}' unless defined(&ATOMIC_LLONG_LOCK_FREE);
    eval 'sub ATOMIC_POINTER_LOCK_FREE () { &__GCC_ATOMIC_POINTER_LOCK_FREE;}' unless defined(&ATOMIC_POINTER_LOCK_FREE);
    eval 'sub atomic_store_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__atomic_store_ptr = ($PTR);  &__typeof__ (* &__atomic_store_ptr)  &__atomic_store_tmp = ($VAL);  &__atomic_store ( &__atomic_store_ptr, & &__atomic_store_tmp, ($MO)); }));
    }' unless defined(&atomic_store_explicit);
    eval 'sub atomic_store {
        my($PTR, $VAL) = @_;
	    eval q( &atomic_store_explicit ($PTR, $VAL,  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_store);
    eval 'sub atomic_load_explicit {
        my($PTR, $MO) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__atomic_load_ptr = ($PTR);  &__typeof__ (* &__atomic_load_ptr)  &__atomic_load_tmp;  &__atomic_load ( &__atomic_load_ptr, & &__atomic_load_tmp, ($MO));  &__atomic_load_tmp; }));
    }' unless defined(&atomic_load_explicit);
    eval 'sub atomic_load {
        my($PTR) = @_;
	    eval q( &atomic_load_explicit ($PTR,  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_load);
    eval 'sub atomic_exchange_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__atomic_exchange_ptr = ($PTR);  &__typeof__ (* &__atomic_exchange_ptr)  &__atomic_exchange_val = ($VAL);  &__typeof__ (* &__atomic_exchange_ptr)  &__atomic_exchange_tmp;  &__atomic_exchange ( &__atomic_exchange_ptr, & &__atomic_exchange_val, & &__atomic_exchange_tmp, ($MO));  &__atomic_exchange_tmp; }));
    }' unless defined(&atomic_exchange_explicit);
    eval 'sub atomic_exchange {
        my($PTR, $VAL) = @_;
	    eval q( &atomic_exchange_explicit ($PTR, $VAL,  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_exchange);
    eval 'sub atomic_compare_exchange_strong_explicit {
        my($PTR, $VAL, $DES, $SUC, $FAIL) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__atomic_compare_exchange_ptr = ($PTR);  &__typeof__ (* &__atomic_compare_exchange_ptr)  &__atomic_compare_exchange_tmp = ($DES);  &__atomic_compare_exchange ( &__atomic_compare_exchange_ptr, ($VAL), & &__atomic_compare_exchange_tmp, 0, ($SUC), ($FAIL)); }));
    }' unless defined(&atomic_compare_exchange_strong_explicit);
    eval 'sub atomic_compare_exchange_strong {
        my($PTR, $VAL, $DES) = @_;
	    eval q( &atomic_compare_exchange_strong_explicit ($PTR, $VAL, $DES,  &__ATOMIC_SEQ_CST,  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_compare_exchange_strong);
    eval 'sub atomic_compare_exchange_weak_explicit {
        my($PTR, $VAL, $DES, $SUC, $FAIL) = @_;
	    eval q( &__extension__ ({  &__auto_type  &__atomic_compare_exchange_ptr = ($PTR);  &__typeof__ (* &__atomic_compare_exchange_ptr)  &__atomic_compare_exchange_tmp = ($DES);  &__atomic_compare_exchange ( &__atomic_compare_exchange_ptr, ($VAL), & &__atomic_compare_exchange_tmp, 1, ($SUC), ($FAIL)); }));
    }' unless defined(&atomic_compare_exchange_weak_explicit);
    eval 'sub atomic_compare_exchange_weak {
        my($PTR, $VAL, $DES) = @_;
	    eval q( &atomic_compare_exchange_weak_explicit ($PTR, $VAL, $DES,  &__ATOMIC_SEQ_CST,  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_compare_exchange_weak);
    eval 'sub atomic_fetch_add {
        my($PTR, $VAL) = @_;
	    eval q( &__atomic_fetch_add (($PTR), ($VAL),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_fetch_add);
    eval 'sub atomic_fetch_add_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__atomic_fetch_add (($PTR), ($VAL), ($MO)));
    }' unless defined(&atomic_fetch_add_explicit);
    eval 'sub atomic_fetch_sub {
        my($PTR, $VAL) = @_;
	    eval q( &__atomic_fetch_sub (($PTR), ($VAL),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_fetch_sub);
    eval 'sub atomic_fetch_sub_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__atomic_fetch_sub (($PTR), ($VAL), ($MO)));
    }' unless defined(&atomic_fetch_sub_explicit);
    eval 'sub atomic_fetch_or {
        my($PTR, $VAL) = @_;
	    eval q( &__atomic_fetch_or (($PTR), ($VAL),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_fetch_or);
    eval 'sub atomic_fetch_or_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__atomic_fetch_or (($PTR), ($VAL), ($MO)));
    }' unless defined(&atomic_fetch_or_explicit);
    eval 'sub atomic_fetch_xor {
        my($PTR, $VAL) = @_;
	    eval q( &__atomic_fetch_xor (($PTR), ($VAL),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_fetch_xor);
    eval 'sub atomic_fetch_xor_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__atomic_fetch_xor (($PTR), ($VAL), ($MO)));
    }' unless defined(&atomic_fetch_xor_explicit);
    eval 'sub atomic_fetch_and {
        my($PTR, $VAL) = @_;
	    eval q( &__atomic_fetch_and (($PTR), ($VAL),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_fetch_and);
    eval 'sub atomic_fetch_and_explicit {
        my($PTR, $VAL, $MO) = @_;
	    eval q( &__atomic_fetch_and (($PTR), ($VAL), ($MO)));
    }' unless defined(&atomic_fetch_and_explicit);
    if((defined(&__GCC_ATOMIC_TEST_AND_SET_TRUEVAL) ? &__GCC_ATOMIC_TEST_AND_SET_TRUEVAL : undef) == 1) {
    } else {
    }
    eval 'sub ATOMIC_FLAG_INIT () {{ 0};}' unless defined(&ATOMIC_FLAG_INIT);
    eval 'sub atomic_flag_test_and_set {
        my($PTR) = @_;
	    eval q( &__atomic_test_and_set (($PTR),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_flag_test_and_set);
    eval 'sub atomic_flag_test_and_set_explicit {
        my($PTR, $MO) = @_;
	    eval q( &__atomic_test_and_set (($PTR), ($MO)));
    }' unless defined(&atomic_flag_test_and_set_explicit);
    eval 'sub atomic_flag_clear {
        my($PTR) = @_;
	    eval q( &__atomic_clear (($PTR),  &__ATOMIC_SEQ_CST));
    }' unless defined(&atomic_flag_clear);
    eval 'sub atomic_flag_clear_explicit {
        my($PTR, $MO) = @_;
	    eval q( &__atomic_clear (($PTR), ($MO)));
    }' unless defined(&atomic_flag_clear_explicit);
}
1;
