using word = unsigned long long;

struct Counter {
    word base;
    word add(word increment) const;
};

[[gnu::noinline]] word Counter::add(word increment) const {
    return base + increment;
}

extern "C" [[gnu::noinline]] word counter_add(const Counter *counter, word increment) {
    return counter->add(increment);
}

int main() {
    const Counter counter{40};
    return counter_add(&counter, 2) == 42 ? 0 : 1;
}
