#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void gffi_set_single_float_swapped(uint8_t *location, int offset, float value) {
  uint8_t *buf = (uint8_t *)&value;
  location[offset + 0] = buf[3];
  location[offset + 1] = buf[2];
  location[offset + 2] = buf[1];
  location[offset + 3] = buf[0];
}


x86 assembly (clang, -O0):
<gffi_set_single_float_swapped>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gffi_set_single_float_swapped>:
movslq %esi,%rax
movss  %xmm0,0xc(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @gffi_set_single_float_swapped(i32* nocapture writeonly %0, i32 %1, float %2) {
%4 = add nsw i32 %1, 3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = bitcast i32* %6 to float*
store float %2, float* %7
ret void
}