// #target: macos-x64
module test;

fn int main() {
  int[<4>] vec;
  @foo(vec[0]);
  @foo(vec[2]);
  assert(vec[0] == 1);
  assert(vec[2] == 1);
  return 1;
}

macro @foo(#ref) {
  #ref += 1;
}

/* #expect: test.ll


define i32 @main() #0 {
entry:
  %vec = alloca <4 x i32>, align 16
  store <4 x i32> zeroinitializer, ptr %vec, align 16
  %0 = load <4 x i32>, ptr %vec, align 16
  %elem = extractelement <4 x i32> %0, i64 0
  %add = add i32 %elem, 1
  %elemset = insertelement <4 x i32> %0, i32 %add, i64 0
  store <4 x i32> %elemset, ptr %vec, align 16
  %1 = load <4 x i32>, ptr %vec, align 16
  %elem1 = extractelement <4 x i32> %1, i64 2
  %add2 = add i32 %elem1, 1
  %elemset3 = insertelement <4 x i32> %1, i32 %add2, i64 2
  store <4 x i32> %elemset3, ptr %vec, align 16
  %2 = load <4 x i32>, ptr %vec, align 16
  %3 = extractelement <4 x i32> %2, i64 0
  %eq = icmp eq i32 %3, 1
  call void @llvm.assume(i1 %eq)
  %4 = load <4 x i32>, ptr %vec, align 16
  %5 = extractelement <4 x i32> %4, i64 2
  %eq4 = icmp eq i32 %5, 1
  call void @llvm.assume(i1 %eq4)
  ret i32 1
}

declare void @llvm.assume(i1 noundef) #1
attributes #0 = { nounwind uwtable "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 2, !"wchar_size", i32 4}
!3 = !{i32 4, !"PIC Level", i32 2}
!4 = !{i32 1, !"uwtable", i32 2}
!5 = !{i32 2, !"frame-pointer", i32 2}