#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 */

/* Variables and functions */
scalar_t__ floor(double);
int /*<<< orphan*/ setbits(unsigned char *, int, int, int);
int /*<<< orphan*/ setbitu(unsigned char *, int, int, unsigned int);
void set38bits(unsigned char *buff, int pos, double value) {
  int word_h = (int)floor(value / ((double)64.0L));
  unsigned int word_l = (unsigned int)(value - word_h * ((double)64.0L));
  setbits(buff, pos, 32, word_h);
  setbitu(buff, pos + 32, 6, word_l);
}


x86 assembly (clang, -O0):
<set38bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
movsd  %xmm1,-0x28(%rbp)
divsd  %xmm1,%xmm0
call   1050 <floor@plt>
movsd  -0x28(%rbp),%xmm2
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%ecx
mov    $0x20,%edx
call   1030 <setbits@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x20,%esi
mov    -0x20(%rbp),%ecx
mov    $0x6,%edx
call   1040 <setbitu@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set38bits>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
mov    %esi,%ebx
mov    %rdi,%r14
movsd  0xeb0(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xea0(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%r15
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x20,%edx
mov    %eax,%ecx
call   1030 <setbits@plt>
add    $0x20,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %r15d,%ecx
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <setbitu@plt>

LLVM IR (-O0):
define void @set38bits(i8* %0, i32 %1, double %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store double %2, double* %6
%9 = load double, double* %6
%10 = fdiv double %9, 6.400000e+01
%11 = call i64 @floor(double %10)
%12 = trunc i64 %11 to i32
store i32 %12, i32* %7
%13 = load double, double* %6
%14 = load i32, i32* %7
%15 = sitofp i32 %14 to double
%16 = fneg double %15
%17 = call double @llvm.fmuladd.f64(double %16, double 6.400000e+01, double %13)
%18 = fptoui double %17 to i32
store i32 %18, i32* %8
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = call i32 @setbits(i8* %19, i32 %20, i32 32, i32 %21)
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 32
%26 = load i32, i32* %8
%27 = call i32 @setbitu(i8* %23, i32 %25, i32 6, i32 %26)
ret void
}

LLVM IR (-O2):
define void @set38bits(i8* %0, i32 %1, double %2) {
%4 = fmul double %2, 1.562500e-02
%5 = tail call i64 @floor(double %4)
%6 = trunc i64 %5 to i32
%7 = sitofp i32 %6 to double
%8 = fneg double %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double 6.400000e+01, double %2)
%10 = fptoui double %9 to i32
%11 = tail call i32 @setbits(i8* %0, i32 %1, i32 32, i32 %6)
%12 = add nsw i32 %1, 32
%13 = tail call i32 @setbitu(i8* %0, i32 %12, i32 6, i32 %10)
ret void
}