void sample_move_d32u24_sS(char *dst, float *src, unsigned long nsamples,
                           unsigned long dst_skip) {
  long long y;
  while (nsamples--) {
    y = (long long)(*src * 8388608.0f) << 8;
    if (y > 2147483647) {
      *(int *)dst = 2147483647;
    } else if (y < -2147483647 - 1) {
      *(int *)dst = -2147483647 - 1;
    } else {
      *(int *)dst = (int)y;
    }
    dst += dst_skip;
    src++;
  }
}


x86 assembly (clang, -O0):
<sample_move_d32u24_sS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     11b2 <sample_move_d32u24_sS+0xb2>
mov    -0x10(%rbp),%rax
movss  0xec7(%rip),%xmm0
mulss  (%rax),%xmm0
cvttss2si %xmm0,%rax
shl    $0x8,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x7fffffff,-0x28(%rbp)
7f
jle    1167 <sample_move_d32u24_sS+0x67>
mov    -0x8(%rbp),%rax
movl   $0x7fffffff,(%rax)
jmp    1195 <sample_move_d32u24_sS+0x95>
cmpq   $0xffffffff80000000,-0x28(%rbp)
80
jge    1184 <sample_move_d32u24_sS+0x84>
mov    -0x8(%rbp),%rax
movl   $0x80000000,(%rax)
jmp    1190 <sample_move_d32u24_sS+0x90>
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    1195 <sample_move_d32u24_sS+0x95>
mov    -0x20(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <sample_move_d32u24_sS+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_move_d32u24_sS>:
test   %rdx,%rdx
je     115e <sample_move_d32u24_sS+0x5e>
test   $0x1,%dl
jne    1115 <sample_move_d32u24_sS+0x15>
mov    %rdx,%r8
cmp    $0x1,%rdx
je     115e <sample_move_d32u24_sS+0x5e>
jmp    115f <sample_move_d32u24_sS+0x5f>
movss  (%rsi),%xmm0
mulss  0xedf(%rip),%xmm0
cvttss2si %xmm0,%rax
shl    $0x8,%rax
cmp    $0xffffffff80000001,%rax
mov    $0xffffffff80000000,%r8
cmovge %rax,%r8
cmp    $0x7fffffff,%r8
mov    $0x7fffffff,%eax
cmovl  %r8d,%eax
lea    -0x1(%rdx),%r8
mov    %eax,(%rdi)
add    %rcx,%rdi
add    $0x4,%rsi
cmp    $0x1,%rdx
jne    115f <sample_move_d32u24_sS+0x5f>
ret
xor    %edx,%edx
movss  0xe97(%rip),%xmm0
jmp    1182 <sample_move_d32u24_sS+0x82>
nopl   0x0(%rax,%rax,1)
mov    %eax,(%rdi,%rcx,1)
add    %rcx,%r9
add    $0x2,%rdx
mov    %r9,%rdi
cmp    %rdx,%r8
je     115e <sample_move_d32u24_sS+0x5e>
movss  (%rsi,%rdx,4),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%rax
shl    $0x8,%rax
cmp    $0xffffffff80000001,%rax
jge    11a3 <sample_move_d32u24_sS+0xa3>
mov    $0xffffffff80000000,%rax
cmp    $0x7fffffff,%rax
jl     11b0 <sample_move_d32u24_sS+0xb0>
mov    $0x7fffffff,%eax
mov    %eax,(%rdi)
movss  0x4(%rsi,%rdx,4),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%rax
shl    $0x8,%rax
cmp    $0xffffffff80000001,%rax
jge    11d4 <sample_move_d32u24_sS+0xd4>
mov    $0xffffffff80000000,%rax
lea    (%rdi,%rcx,1),%r9
cmp    $0x7fffffff,%rax
jl     1170 <sample_move_d32u24_sS+0x70>
mov    $0x7fffffff,%eax
jmp    1170 <sample_move_d32u24_sS+0x70>

LLVM IR (-O0):
define void @sample_move_d32u24_sS(i8* %0, float* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store float* %1, float** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
br label %10
10: ; preds = %37, %4
%11 = load i64, i64* %7
%12 = add i64 %11, -1
store i64 %12, i64* %7
%13 = icmp ne i64 %11, 0
br i1 %13, label %14, label %43
14: ; preds = %10
%15 = load float*, float** %6
%16 = load float, float* %15
%17 = fmul float %16, 0x4160000000000000
%18 = fptosi float %17 to i64
%19 = shl i64 %18, 8
store i64 %19, i64* %9
%20 = load i64, i64* %9
%21 = icmp sgt i64 %20, 2147483647
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i8*, i8** %5
%24 = bitcast i8* %23 to i32*
store i32 2147483647, i32* %24
br label %37
25: ; preds = %14
%26 = load i64, i64* %9
%27 = icmp slt i64 %26, -2147483648
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i8*, i8** %5
%30 = bitcast i8* %29 to i32*
store i32 -2147483648, i32* %30
br label %36
31: ; preds = %25
%32 = load i64, i64* %9
%33 = trunc i64 %32 to i32
%34 = load i8*, i8** %5
%35 = bitcast i8* %34 to i32*
store i32 %33, i32* %35
br label %36
36: ; preds = %31, %28
br label %37
37: ; preds = %36, %22
%38 = load i64, i64* %8
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i64 %38
store i8* %40, i8** %5
%41 = load float*, float** %6
%42 = getelementptr inbounds float, float* %41, i32 1
store float* %42, float** %6
br label %10
43: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @sample_move_d32u24_sS(i8* nocapture writeonly %0, float* nocapture %1, i64 %2, i64 %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %58, label %6
6: ; preds = %4
%7 = and i64 %2, 1
%8 = icmp eq i64 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %6
%10 = add i64 %2, -1
%11 = load float, float* %1
%12 = fmul float %11, 0x4160000000000000
%13 = fptosi float %12 to i64
%14 = shl i64 %13, 8
%15 = icmp sgt i64 %14, -2147483648
%16 = select i1 %15, i64 %14, i64 -2147483648
%17 = icmp slt i64 %16, 2147483647
%18 = select i1 %17, i64 %16, i64 2147483647
%19 = trunc i64 %18 to i32
%20 = bitcast i8* %0 to i32*
store i32 %19, i32* %20
%21 = getelementptr inbounds i8, i8* %0, i64 %3
%22 = getelementptr inbounds float, float* %1, i64 1
br label %23
23: ; preds = %9, %6
%24 = phi i64 [ %2, %6 ], [ %10, %9 ]
%25 = phi i8* [ %0, %6 ], [ %21, %9 ]
%26 = phi float* [ %1, %6 ], [ %22, %9 ]
%27 = icmp eq i64 %2, 1
br i1 %27, label %58, label %28
28: ; preds = %23, %28
%29 = phi i64 [ %44, %28 ], [ %24, %23 ]
%30 = phi i8* [ %55, %28 ], [ %25, %23 ]
%31 = phi float* [ %56, %28 ], [ %26, %23 ]
%32 = load float, float* %31
%33 = fmul float %32, 0x4160000000000000
%34 = fptosi float %33 to i64
%35 = shl i64 %34, 8
%36 = icmp sgt i64 %35, -2147483648
%37 = select i1 %36, i64 %35, i64 -2147483648
%38 = icmp slt i64 %37, 2147483647
%39 = select i1 %38, i64 %37, i64 2147483647
%40 = trunc i64 %39 to i32
%41 = bitcast i8* %30 to i32*
store i32 %40, i32* %41
%42 = getelementptr inbounds i8, i8* %30, i64 %3
%43 = getelementptr inbounds float, float* %31, i64 1
%44 = add i64 %29, -2
%45 = load float, float* %43
%46 = fmul float %45, 0x4160000000000000
%47 = fptosi float %46 to i64
%48 = shl i64 %47, 8
%49 = icmp sgt i64 %48, -2147483648
%50 = select i1 %49, i64 %48, i64 -2147483648
%51 = icmp slt i64 %50, 2147483647
%52 = select i1 %51, i64 %50, i64 2147483647
%53 = trunc i64 %52 to i32
%54 = bitcast i8* %42 to i32*
store i32 %53, i32* %54
%55 = getelementptr inbounds i8, i8* %42, i64 %3
%56 = getelementptr inbounds float, float* %31, i64 2
%57 = icmp eq i64 %44, 0
br i1 %57, label %58, label %28
58: ; preds = %23, %28, %4
ret void
}