// #target: macos-x64

module testing;
import std::io;

fn void main()
{
    Bits b1;
    Bits b2;
    bool x = equals(b1, b2);
}

bitstruct Bits : char
{
    bool flag;
}

fn bool Bits.equals(a, Bits b)
{
    return a.flag == b.flag;
}

/* #expect: testing.ll

entry:
  %b1 = alloca i8, align 1
  %b2 = alloca i8, align 1
  %x = alloca i8, align 1
  %a = alloca i8, align 1
  %b = alloca i8, align 1
  store i8 0, ptr %b1, align 1
  store i8 0, ptr %b2, align 1
  %0 = load i8, ptr %b1, align 1
  store i8 %0, ptr %a, align 1
  %1 = load i8, ptr %b2, align 1
  store i8 %1, ptr %b, align 1
  %2 = load i8, ptr %a, align 1
  %3 = load i8, ptr %b, align 1
  %4 = call i8 @testing.Bits.equals(i8 zeroext %2, i8 zeroext %3)
  store i8 %4, ptr %x, align 1
