#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 uint32_t;

/* Variables and functions */
scalar_t__ cvt_neari_sat_u8_f32(float);
uint32_t __hsail_packcvt(float a, float b, float c, float d) {
  return (uint32_t)cvt_neari_sat_u8_f32(a) |
         (uint32_t)cvt_neari_sat_u8_f32(b) << 8 |
         (uint32_t)cvt_neari_sat_u8_f32(c) << 16 |
         (uint32_t)cvt_neari_sat_u8_f32(d) << 24;
}


x86 assembly (clang, -O0):
<__hsail_packcvt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %eax,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%rcx
mov    -0x1c(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
shl    $0x18,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_packcvt>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movss  %xmm3,0x14(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%r14
movss  0xc(%rsp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%rbx
shl    $0x8,%ebx
or     %r14d,%ebx
movss  0x10(%rsp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
mov    %rax,%r14
shl    $0x10,%r14d
movss  0x14(%rsp),%xmm0
call   1030 <cvt_neari_sat_u8_f32@plt>
shl    $0x18,%eax
or     %r14d,%eax
or     %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @__hsail_packcvt(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = call i64 @cvt_neari_sat_u8_f32(float %9)
%11 = trunc i64 %10 to i32
%12 = load float, float* %6
%13 = call i64 @cvt_neari_sat_u8_f32(float %12)
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load float, float* %7
%18 = call i64 @cvt_neari_sat_u8_f32(float %17)
%19 = trunc i64 %18 to i32
%20 = shl i32 %19, 16
%21 = or i32 %16, %20
%22 = load float, float* %8
%23 = call i64 @cvt_neari_sat_u8_f32(float %22)
%24 = trunc i64 %23 to i32
%25 = shl i32 %24, 24
%26 = or i32 %21, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @__hsail_packcvt(float %0, float %1, float %2, float %3) {
%5 = tail call i64 @cvt_neari_sat_u8_f32(float %0)
%6 = trunc i64 %5 to i32
%7 = tail call i64 @cvt_neari_sat_u8_f32(float %1)
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = or i32 %9, %6
%11 = tail call i64 @cvt_neari_sat_u8_f32(float %2)
%12 = trunc i64 %11 to i32
%13 = shl i32 %12, 16
%14 = or i32 %10, %13
%15 = tail call i64 @cvt_neari_sat_u8_f32(float %3)
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}