#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, float *, int);
void GST_WRITE_FLOAT_BE(uint8_t *data, float num) {
  float f = num;
  uint32_t i = 0;
  memcpy(&i, &f, sizeof(float));
  do {
    ((uint8_t *)(data))[0] = (((uint32_t)(i)) >> 24) & 0xff;
    ((uint8_t *)(data))[1] = (((uint32_t)(i)) >> 16) & 0xff;
    ((uint8_t *)(data))[2] = (((uint32_t)(i)) >> 8) & 0xff;
    ((uint8_t *)(data))[3] = (((uint32_t)(i)) >> 0) & 0xff;
  } while (0);
}


x86 assembly (clang, -O0):
<GST_WRITE_FLOAT_BE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GST_WRITE_FLOAT_BE>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,(%rbx)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rbx)
mov    %edx,0x8(%rbx)
mov    %esi,0xc(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @GST_WRITE_FLOAT_BE(i32* %0, float %1) {
%3 = alloca i32*
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32* %0, i32** %3
store float %1, float* %4
%7 = load float, float* %4
store float %7, float* %5
store i32 0, i32* %6
%8 = call i32 @memcpy(i32* %6, float* %5, i32 4)
br label %9
9: ; preds = %2
%10 = load i32, i32* %6
%11 = ashr i32 %10, 24
%12 = and i32 %11, 255
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 %12, i32* %14
%15 = load i32, i32* %6
%16 = ashr i32 %15, 16
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %17, i32* %19
%20 = load i32, i32* %6
%21 = ashr i32 %20, 8
%22 = and i32 %21, 255
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i64 2
store i32 %22, i32* %24
%25 = load i32, i32* %6
%26 = ashr i32 %25, 0
%27 = and i32 %26, 255
%28 = load i32*, i32** %3
%29 = getelementptr inbounds i32, i32* %28, i64 3
store i32 %27, i32* %29
br label %30
30: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @GST_WRITE_FLOAT_BE(i32* nocapture writeonly %0, float %1) {
%3 = alloca float
%4 = alloca i32
%5 = bitcast float* %3 to i8*
store float %1, float* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = call i32 @memcpy(i32* %4, float* %3, i32 4)
%8 = load i32, i32* %4
%9 = lshr i32 %8, 24
store i32 %9, i32* %0
%10 = lshr i32 %8, 16
%11 = and i32 %10, 255
%12 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %11, i32* %12
%13 = lshr i32 %8, 8
%14 = and i32 %13, 255
%15 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %14, i32* %15
%16 = and i32 %8, 255
%17 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %16, i32* %17
ret void
}