// #target: macos-x64
module foo;
import libc;

struct Matrix2x2
{
	union
	{
		struct {
			float m00, m01, m10, m11;
		}
		float[4] m;
	}
}

struct Matrix2x2_b
{
	union
	{
		float[4] m;
		struct {
			float m00, m01, m10, m11;
		}
	}
}

fn void main()
{
	Matrix2x2 m = { 1, 2, 3, 4 };
	Matrix2x2_b m2 = { { 1, 2, 3, 4 } };
	libc::printf("%f %f %f %f\n", m.m00, m.m[1], m.m10, m.m[3]);
}
/* #expect: foo.ll

%Matrix2x2 = type { %.anon }
%.anon = type { %.anon.0 }
%.anon.0 = type { float, float, float, float }
%Matrix2x2_b = type { %.anon.1 }
%.anon.1 = type { [4 x float] }

@"$ct.foo.$anon" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
@"$ct.foo.$anon.3" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
@"$ct.foo.Matrix2x2" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
@"$ct.foo.$anon.6" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 4, [0 x i64] zeroinitializer }, align 8
@"$ct.foo.$anon.7" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
@"$ct.foo.Matrix2x2_b" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8
@.__const = private unnamed_addr constant %Matrix2x2 { %.anon { %.anon.0 { float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 } } }, align 4
@.__const.8 = private unnamed_addr constant %Matrix2x2_b { %.anon.1 { [4 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00] } }, align 4
@.str = private unnamed_addr constant [13 x i8] c"%f %f %f %f\0A\00", align 1

; Function Attrs:
define void @foo.main() #0 {
entry:
  %m = alloca %Matrix2x2, align 4
  %m2 = alloca %Matrix2x2_b, align 4
  call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m, ptr align 4 @.__const, i32 16, i1 false)
  call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m2, ptr align 4 @.__const.8, i32 16, i1 false)
  %0 = load float, ptr %m, align 4
  %fpfpext = fpext float %0 to double
  %ptradd = getelementptr inbounds i8, ptr %m, i64 4
  %1 = load float, ptr %ptradd, align 4
  %fpfpext1 = fpext float %1 to double
  %ptradd2 = getelementptr inbounds i8, ptr %m, i64 8
  %2 = load float, ptr %ptradd2, align 4
  %fpfpext3 = fpext float %2 to double
  %ptradd4 = getelementptr inbounds i8, ptr %m, i64 12
  %3 = load float, ptr %ptradd4, align 4
  %fpfpext5 = fpext float %3 to double
  %4 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext, double %fpfpext1, double %fpfpext3, double %fpfpext5)
  ret void
}
