__attribute__((no, noclone)) void fn5(void) {
  volatile struct S {
    char b;
    char a[1];
  } s;
  volatile struct U {
    int a;
    struct S s;
  } u;
  volatile int i;
  asm("" : : "r"(&u.s.a) : "memory");
  i = u.s.a[0];
  asm("" : : "r"(&u.s.a) : "memory");
  i = u.s.a[1];
  volatile struct U *pu = &u;
  asm("" : : "r"(&pu->s.a) : "memory");
  i = pu->s.a[0];
  asm("" : : "r"(&pu->s.a) : "memory");
  i = pu->s.a[1];
}


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
lea    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x1,%rax
mov    -0xb(%rbp),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x1,%rax
mov    -0xa(%rbp),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rax
mov    0x5(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rax
mov    0x6(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn5>:
lea    -0x3(%rsp),%rax
movsbl -0x3(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x2(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x3(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x2(%rsp),%eax
mov    %eax,-0xc(%rsp)
ret

LLVM IR (-O0):
%struct.S = type { i8, [1 x i8] }
%struct.U = type { i32, %struct.S }
define void @fn5() {
%1 = alloca %struct.S
%2 = alloca %struct.U
%3 = alloca i32
%4 = alloca %struct.U*
%5 = getelementptr inbounds %struct.U, %struct.U* %2, i32 0, i32 1
%6 = getelementptr inbounds %struct.S, %struct.S* %5, i32 0, i32 1
%7 = getelementptr inbounds %struct.U, %struct.U* %2, i32 0, i32 1
%8 = getelementptr inbounds %struct.S, %struct.S* %7, i32 0, i32 1
%9 = getelementptr inbounds [1 x i8], [1 x i8]* %8, i64 0, i64 0
%10 = load volatile i8, i8* %9
%11 = sext i8 %10 to i32
store volatile i32 %11, i32* %3
%12 = getelementptr inbounds %struct.U, %struct.U* %2, i32 0, i32 1
%13 = getelementptr inbounds %struct.S, %struct.S* %12, i32 0, i32 1
%14 = getelementptr inbounds %struct.U, %struct.U* %2, i32 0, i32 1
%15 = getelementptr inbounds %struct.S, %struct.S* %14, i32 0, i32 1
%16 = getelementptr inbounds [1 x i8], [1 x i8]* %15, i64 0, i64 1
%17 = load volatile i8, i8* %16
%18 = sext i8 %17 to i32
store volatile i32 %18, i32* %3
store %struct.U* %2, %struct.U** %4
%19 = load %struct.U*, %struct.U** %4
%20 = getelementptr inbounds %struct.U, %struct.U* %19, i32 0, i32 1
%21 = getelementptr inbounds %struct.S, %struct.S* %20, i32 0, i32 1
%22 = load %struct.U*, %struct.U** %4
%23 = getelementptr inbounds %struct.U, %struct.U* %22, i32 0, i32 1
%24 = getelementptr inbounds %struct.S, %struct.S* %23, i32 0, i32 1
%25 = getelementptr inbounds [1 x i8], [1 x i8]* %24, i64 0, i64 0
%26 = load volatile i8, i8* %25
%27 = sext i8 %26 to i32
store volatile i32 %27, i32* %3
%28 = load %struct.U*, %struct.U** %4
%29 = getelementptr inbounds %struct.U, %struct.U* %28, i32 0, i32 1
%30 = getelementptr inbounds %struct.S, %struct.S* %29, i32 0, i32 1
%31 = load %struct.U*, %struct.U** %4
%32 = getelementptr inbounds %struct.U, %struct.U* %31, i32 0, i32 1
%33 = getelementptr inbounds %struct.S, %struct.S* %32, i32 0, i32 1
%34 = getelementptr inbounds [1 x i8], [1 x i8]* %33, i64 0, i64 1
%35 = load volatile i8, i8* %34
%36 = sext i8 %35 to i32
store volatile i32 %36, i32* %3
ret void
}

LLVM IR (-O2):
%struct.U = type { i32, %struct.S }
%struct.S = type { i8, [1 x i8] }
define void @fn5() {
%1 = alloca %struct.U
%2 = alloca i32
%3 = bitcast %struct.U* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds %struct.U, %struct.U* %1, i64 0, i32 1, i32 1
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%7 = load volatile i8, i8* %6
%8 = sext i8 %7 to i32
store volatile i32 %8, i32* %2
%9 = getelementptr inbounds %struct.U, %struct.U* %1, i64 0, i32 1, i32 1, i64 1
%10 = load volatile i8, i8* %9
%11 = sext i8 %10 to i32
store volatile i32 %11, i32* %2
%12 = load volatile i8, i8* %6
%13 = sext i8 %12 to i32
store volatile i32 %13, i32* %2
%14 = load volatile i8, i8* %9
%15 = sext i8 %14 to i32
store volatile i32 %15, i32* %2
ret void
}