#include <atomic>
#include <cassert>
#include <string>
#include <thread>

//uint64_t x{0};

std::atomic<uint64_t> x{0};
std::atomic<uint64_t> y{0};

void producer() {
    for (size_t i = 0; i < 1000'000'000; ++i) {
        //++x;

        x.fetch_add(1, std::memory_order_relaxed);
        y.fetch_add(1, std::memory_order_relaxed);

        //y.fetch_add(1, std::memory_order_release);
    }
}

void consumer() {
    for (size_t i = 0; i < 1000'000'000; ++i) {
        //uint64_t yy = y.load(std::memory_order_acquire);

        uint64_t yy = y.load(std::memory_order_relaxed);
        uint64_t xx = x.load(std::memory_order_relaxed);

        assert(xx >= yy);
    }
}

int main() {
    std::jthread t1(producer);
    std::jthread t2(consumer);
}
