in_swapf(f) float *f;
{
  union SWAPF {
    float f;
    unsigned char c[4];
  } * u;
  unsigned char t;
  u = (union SWAPF *)f;
  t = u->c[0];
  u->c[0] = u->c[3];
  u->c[3] = t;
  t = u->c[1];
  u->c[1] = u->c[2];
  u->c[2] = t;
}


x86 assembly (clang, -O0):
<in_swapf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_swapf>:
mov    (%rdi),%al
mov    0x3(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

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

LLVM IR (-O2):
define i32 @in_swapf(float* nocapture %0) {
%2 = bitcast float* %0 to [4 x i8]*
%3 = bitcast float* %0 to i8*
%4 = load i8, i8* %3
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%6 = load i8, i8* %5
store i8 %6, i8* %3
store i8 %4, i8* %5
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%8 = load i8, i8* %7
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%10 = load i8, i8* %9
store i8 %10, i8* %7
store i8 %8, i8* %9
ret i32 undef
}