int main() {
  int test[5] = {};
  test[2] = 47;
  float test2[5] = {};
  test2[2] = 42;
  printf("%i\n", test[2]);
  printf("%i\n", 2 [test]);
  printf("%f\n", test2[2]);
  printf("%f\n", 2 [test2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movl   $0x2f,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2f,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rbx
movsd  0xebb(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xea6(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x float]
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
store i32 47, i32* %5
%6 = bitcast [5 x float]* %3 to i8*
%7 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
store float 4.200000e+01, float* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 2
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 47)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 47)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 4.200000e+01)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 4.200000e+01)
ret i32 0
}