__attribute__((no, noclone)) void fn2(void) {
  struct S {
    int c;
    char d[4];
  };
  volatile struct T {
    int e;
    struct S f;
    int g;
  } t;
  volatile int i;
  asm("" : : "r"(&t.f.d) : "memory");
  i = t.f.d[3];
  asm("" : : "r"(&t.f.d) : "memory");
  i = t.f.d[4];
  volatile struct T *p = &t;
  asm("" : : "r"(&p->f.d) : "memory");
  i = p->f.d[3];
  asm("" : : "r"(&p->f.d) : "memory");
  i = p->f.d[4];
}


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
lea    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x4,%rax
mov    -0x5(%rbp),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x4,%rax
mov    -0x4(%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    $0x4,%rax
mov    -0x20(%rbp),%rax
mov    0xb(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
add    $0x4,%rax
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%al
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn2>:
lea    -0x8(%rsp),%rax
movsbl -0x5(%rsp),%ecx
mov    %ecx,-0x14(%rsp)
movsbl -0x4(%rsp),%ecx
mov    %ecx,-0x14(%rsp)
movsbl -0x5(%rsp),%ecx
mov    %ecx,-0x14(%rsp)
movsbl -0x4(%rsp),%eax
mov    %eax,-0x14(%rsp)
ret

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

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