void *compound_literal(int x, int y) {
  if (x)
    return &(unsigned short){((unsigned short)0x22EF)};
  int *array[] = {};
  struct s {
    int z;
    double y;
    int w;
  };
  if (y)
    return &((struct s){2, 0.4, 5 * 8});
  void *p = &((struct s){42, 0.4, x ? 42 : 0});
  return p;
}


x86 assembly (clang, -O0):
<compound_literal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1127 <compound_literal+0x27>
movw   $0x22ef,-0x12(%rbp)
lea    -0x12(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1190 <compound_literal+0x90>
cmpl   $0x0,-0x10(%rbp)
je     1159 <compound_literal+0x59>
movl   $0x2,-0x30(%rbp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x28,-0x20(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1190 <compound_literal+0x90>
movl   $0x2a,-0x50(%rbp)
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x2a,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x40(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compound_literal>:
test   %edi,%edi
je     1111 <compound_literal+0x11>
movw   $0x22ef,-0x32(%rsp)
lea    -0x32(%rsp),%rax
ret
test   %esi,%esi
je     1129 <compound_literal+0x29>
movl   $0x2,-0x18(%rsp)
mov    $0x28,%ecx
lea    -0x18(%rsp),%rax
jmp    1138 <compound_literal+0x38>
movl   $0x2a,-0x30(%rsp)
xor    %ecx,%ecx
lea    -0x30(%rsp),%rax
movabs $0x3fd999999999999a,%rdx
99 d9 3f
mov    %rdx,0x8(%rax)
mov    %ecx,0x10(%rax)
ret

LLVM IR (-O0):
%struct.s = type { i32, double, i32 }
define i8* @compound_literal(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16
%7 = alloca [0 x i32*]
%8 = alloca %struct.s
%9 = alloca i8*
%10 = alloca %struct.s
store i32 %0, i32* %4
store i32 %1, i32* %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
store i16 8943, i16* %6
%14 = bitcast i16* %6 to i8*
store i8* %14, i8** %3
br label %34
15: ; preds = %2
%16 = bitcast [0 x i32*]* %7 to i8*
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = getelementptr inbounds %struct.s, %struct.s* %8, i32 0, i32 0
store i32 2, i32* %20
%21 = getelementptr inbounds %struct.s, %struct.s* %8, i32 0, i32 1
store double 4.000000e-01, double* %21
%22 = getelementptr inbounds %struct.s, %struct.s* %8, i32 0, i32 2
store i32 40, i32* %22
%23 = bitcast %struct.s* %8 to i8*
store i8* %23, i8** %3
br label %34
24: ; preds = %15
%25 = getelementptr inbounds %struct.s, %struct.s* %10, i32 0, i32 0
store i32 42, i32* %25
%26 = getelementptr inbounds %struct.s, %struct.s* %10, i32 0, i32 1
store double 4.000000e-01, double* %26
%27 = getelementptr inbounds %struct.s, %struct.s* %10, i32 0, i32 2
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 42, i32 0
store i32 %31, i32* %27
%32 = bitcast %struct.s* %10 to i8*
store i8* %32, i8** %9
%33 = load i8*, i8** %9
store i8* %33, i8** %3
br label %34
34: ; preds = %24, %19, %13
%35 = load i8*, i8** %3
ret i8* %35
}

LLVM IR (-O2):
%struct.s = type { i32, double, i32 }
define noalias i8* @compound_literal(i32 %0, i32 %1) {
%3 = alloca i16
%4 = alloca %struct.s
%5 = alloca %struct.s
%6 = icmp eq i32 %0, 0
br i1 %6, label %9, label %7
7: ; preds = %2
store i16 8943, i16* %3
%8 = bitcast i16* %3 to i8*
br label %21
9: ; preds = %2
%10 = icmp eq i32 %1, 0
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = getelementptr inbounds %struct.s, %struct.s* %4, i64 0, i32 0
store i32 2, i32* %12
br label %15
13: ; preds = %9
%14 = getelementptr inbounds %struct.s, %struct.s* %5, i64 0, i32 0
store i32 42, i32* %14
br label %15
15: ; preds = %13, %11
%16 = phi %struct.s* [ %5, %13 ], [ %4, %11 ]
%17 = phi i32 [ 0, %13 ], [ 40, %11 ]
%18 = getelementptr inbounds %struct.s, %struct.s* %16, i64 0, i32 1
store double 4.000000e-01, double* %18
%19 = getelementptr inbounds %struct.s, %struct.s* %16, i64 0, i32 2
store i32 %17, i32* %19
%20 = bitcast %struct.s* %16 to i8*
br label %21
21: ; preds = %15, %7
%22 = phi i8* [ %8, %7 ], [ %20, %15 ]
ret i8* %22
}