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


x86 assembly (clang, -O0):
<fn4>:
push   %rbp
mov    %rsp,%rbp
lea    -0x10(%rbp),%rax
add    $0x1,%rax
mov    -0xf(%rbp),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rax
add    $0x1,%rax
mov    -0xe(%rbp),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rax
mov    0x2(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn4>:
lea    -0x7(%rsp),%rax
movsbl -0x7(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x6(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x7(%rsp),%ecx
mov    %ecx,-0xc(%rsp)
movsbl -0x6(%rsp),%eax
mov    %eax,-0xc(%rsp)
ret

LLVM IR (-O0):
%struct.S = type { i8, [1 x i8] }
%struct.T = type { %struct.S, i32 }
define void @fn4() {
%1 = alloca %struct.S
%2 = alloca %struct.T
%3 = alloca i32
%4 = alloca %struct.T*
%5 = getelementptr inbounds %struct.T, %struct.T* %2, i32 0, i32 0
%6 = getelementptr inbounds %struct.S, %struct.S* %5, i32 0, i32 1
%7 = getelementptr inbounds %struct.T, %struct.T* %2, i32 0, i32 0
%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.T, %struct.T* %2, i32 0, i32 0
%13 = getelementptr inbounds %struct.S, %struct.S* %12, i32 0, i32 1
%14 = getelementptr inbounds %struct.T, %struct.T* %2, i32 0, i32 0
%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.T* %2, %struct.T** %4
%19 = load %struct.T*, %struct.T** %4
%20 = getelementptr inbounds %struct.T, %struct.T* %19, i32 0, i32 0
%21 = getelementptr inbounds %struct.S, %struct.S* %20, i32 0, i32 1
%22 = load %struct.T*, %struct.T** %4
%23 = getelementptr inbounds %struct.T, %struct.T* %22, i32 0, i32 0
%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.T*, %struct.T** %4
%29 = getelementptr inbounds %struct.T, %struct.T* %28, i32 0, i32 0
%30 = getelementptr inbounds %struct.S, %struct.S* %29, i32 0, i32 1
%31 = load %struct.T*, %struct.T** %4
%32 = getelementptr inbounds %struct.T, %struct.T* %31, i32 0, i32 0
%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.T = type { %struct.S, i32 }
%struct.S = type { i8, [1 x i8] }
define void @fn4() {
%1 = alloca %struct.T
%2 = alloca i32
%3 = getelementptr inbounds %struct.T, %struct.T* %1, i64 0, i32 0, i32 0
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds %struct.T, %struct.T* %1, i64 0, i32 0, 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.T, %struct.T* %1, i64 0, i32 0, 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
}