// #target: macos-x64

union Baz
{
    int x;
    double y;
}
struct Bar
{
    int x;
    int y;
}

fn int test()
{
    Baz ffe = { .x = 1 };
    int[1] azz = {};
    var $foo = { 11, 22, 33 };
    static int foo1 = $foo[1];
    int foo2 = $foo[2];
    var $foos = { "Hello!" };
    char* str = $foos[0];
    bool x = ! (int[]) { 1, 2, 3 };
    Bar b = {};
    Baz z = {};
    int[] sub = {};
    Bar[] foo = {};
    Baz[3] baz = {};
    return 1;
}


/* #expect: general_tests.ll

%Baz = type { double }
%Bar = type { i32, i32 }
%"int[]" = type { ptr, i64 }
%"Bar[]" = type { ptr, i64 }

@"$ct.general_tests.Baz" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
@"$ct.general_tests.Bar" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
@.__const = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8
@test.foo1 = internal unnamed_addr global i32 22, align 4
@.str = private unnamed_addr constant [7 x i8] c"Hello!\00", align 1

; Function Attrs:
define i32 @general_tests.test() #0 {
entry:
  %ffe = alloca %Baz, align 8
  %azz = alloca [1 x i32], align 4
  %foo2 = alloca i32, align 4
  %str = alloca ptr, align 8
  %x = alloca i8, align 1
  %b = alloca %Bar, align 4
  %z = alloca %Baz, align 8
  %sub = alloca %"int[]", align 8
  %foo = alloca %"Bar[]", align 8
  %baz = alloca [3 x %Baz], align 16
  call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ffe, ptr align 8 @.__const, i32 8, i1 false)
  store i32 0, ptr %azz, align 4
  store i32 33, ptr %foo2, align 4
  store ptr @.str, ptr %str, align 8
  store i8 0, ptr %x, align 1
  store i32 0, ptr %b, align 4
  %ptradd = getelementptr inbounds i8, ptr %b, i64 4
  store i32 0, ptr %ptradd, align 4
  call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false)
  store %"int[]" zeroinitializer, ptr %sub, align 8
  store %"Bar[]" zeroinitializer, ptr %foo, align 8
  call void @llvm.memset.p0.i64(ptr align 16 %baz, i8 0, i64 24, i1 false)
  ret i32 1
}
