// #target: macos-x64
module test;

typedef Int4V = int[<4>] @simd;

fn void test(Int4V x)
{
	x[1] = 123;
	int y = x[1];
	assert(y == 123);
}

fn int main()
{
	test({ 1, 2, 1, 4 });
	return 0;
}

/* #expect: test.ll

define void @test.test(<4 x i32> %0) #0 {
entry:
  %x = alloca <4 x i32>, align 16
  %y = alloca i32, align 4
  store <4 x i32> %0, ptr %x, align 16
  %1 = load <4 x i32>, ptr %x, align 16
  %elemset = insertelement <4 x i32> %1, i32 123, i64 1
  store <4 x i32> %elemset, ptr %x, align 16
  %2 = load <4 x i32>, ptr %x, align 16
  %3 = extractelement <4 x i32> %2, i64 1
  store i32 %3, ptr %y, align 4
  %4 = load i32, ptr %y, align 4
  %eq = icmp eq i32 %4, 123
  call void @llvm.assume(i1 %eq)
  ret void
}