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


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
lea    -0x8(%rbp),%rax
add    $0x1,%rax
mov    -0x7(%rbp),%al
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rax
add    $0x1,%rax
mov    -0x6(%rbp),%al
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%al
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%al
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.S = type { i8, [1 x i8] }
define void @fn3() {
%1 = alloca %struct.S
%2 = alloca i32
%3 = alloca %struct.S*
%4 = getelementptr inbounds %struct.S, %struct.S* %1, i32 0, i32 1
%5 = getelementptr inbounds %struct.S, %struct.S* %1, 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.S, %struct.S* %1, i32 0, i32 1
%10 = getelementptr inbounds %struct.S, %struct.S* %1, i32 0, i32 1
%11 = getelementptr inbounds [1 x i8], [1 x i8]* %10, i64 0, i64 1
%12 = load volatile i8, i8* %11
%13 = sext i8 %12 to i32
store volatile i32 %13, i32* %2
store %struct.S* %1, %struct.S** %3
%14 = load %struct.S*, %struct.S** %3
%15 = getelementptr inbounds %struct.S, %struct.S* %14, i32 0, i32 1
%16 = load %struct.S*, %struct.S** %3
%17 = getelementptr inbounds %struct.S, %struct.S* %16, i32 0, i32 1
%18 = getelementptr inbounds [1 x i8], [1 x i8]* %17, i64 0, i64 0
%19 = load volatile i8, i8* %18
%20 = sext i8 %19 to i32
store volatile i32 %20, i32* %2
%21 = load %struct.S*, %struct.S** %3
%22 = getelementptr inbounds %struct.S, %struct.S* %21, i32 0, i32 1
%23 = load %struct.S*, %struct.S** %3
%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 1
%26 = load volatile i8, i8* %25
%27 = sext i8 %26 to i32
store volatile i32 %27, i32* %2
ret void
}

LLVM IR (-O2):
%struct.S = type { i8, [1 x i8] }
define void @fn3() {
%1 = alloca %struct.S
%2 = alloca i32
%3 = getelementptr inbounds %struct.S, %struct.S* %1, i64 0, i32 0
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds %struct.S, %struct.S* %1, i64 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.S, %struct.S* %1, i64 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
}