#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 */
int /*<<< orphan*/ bits(int, int, char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, double);
void cc2400_mdmctrl(unsigned short v) {
  char description[64];
  bits(15, 13, "-", "W0", "");
  sprintf(description, "%0.3f kHz", 15.625 * ((v >> 7) & 0x3F));
  bits(12, 7, "MOD_OFFSET", "RW", description);
  sprintf(description, "%0.4f kHz", 3.9062 * (v & 0x7F));
  bits(6, 0, "MOD_DEV", "RW", description);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0xf,%edi
mov    $0xd,%esi
lea    0xed0(%rip),%rdx
lea    0xecb(%rip),%rcx
lea    0xec3(%rip),%r8
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x7,%eax
and    $0x3f,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe9b(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xe9d(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xc,%edi
mov    $0x7,%esi
lea    0xe8d(%rip),%rdx
lea    0xe91(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x7f,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe4b(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xe6d(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x6,%edi
xor    %esi,%esi
lea    0xe60(%rip),%rdx
lea    0xe4c(%rip),%rcx
call   1030 <bits@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
lea    0xede(%rip),%rdx
lea    0xed9(%rip),%rcx
lea    0xed1(%rip),%r8
mov    $0xf,%edi
mov    $0xd,%esi
call   1030 <bits@plt>
mov    %ebx,%eax
shr    $0x7,%eax
and    $0x3f,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe9d(%rip),%xmm0
lea    0xeab(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
lea    0xea3(%rip),%rdx
lea    0xea7(%rip),%r15
mov    $0xc,%edi
mov    $0x7,%esi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <bits@plt>
and    $0x7f,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xe5e(%rip),%xmm0
lea    0xe7c(%rip),%rsi
mov    %r14,%rdi
call   1040 <sprintf@plt>
lea    0xe77(%rip),%rdx
mov    $0x6,%edi
xor    %esi,%esi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <bits@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"W0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"%0.3f kHz\00"
@.str.4 = [11 x i8] c"MOD_OFFSET\00"
@.str.5 = [3 x i8] c"RW\00"
@.str.6 = [10 x i8] c"%0.4f kHz\00"
@.str.7 = [8 x i8] c"MOD_DEV\00"
define void @cc2400_mdmctrl(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [64 x i8]
store i16 %0, i16* %2
%4 = call i32 @bits(i32 15, i32 13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 7
%9 = and i32 %8, 63
%10 = sitofp i32 %9 to double
%11 = fmul double 1.562500e+01, %10
%12 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%14 = call i32 @bits(i32 12, i32 7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%16 = load i16, i16* %2
%17 = zext i16 %16 to i32
%18 = and i32 %17, 127
%19 = sitofp i32 %18 to double
%20 = fmul double 3.906200e+00, %19
%21 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %20)
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%23 = call i32 @bits(i32 6, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"W0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"%0.3f kHz\00"
@.str.4 = [11 x i8] c"MOD_OFFSET\00"
@.str.5 = [3 x i8] c"RW\00"
@.str.6 = [10 x i8] c"%0.4f kHz\00"
@.str.7 = [8 x i8] c"MOD_DEV\00"
define void @cc2400_mdmctrl(i16 zeroext %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @bits(i32 15, i32 13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%5 = zext i16 %0 to i32
%6 = lshr i32 %5, 7
%7 = and i32 %6, 63
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 1.562500e+01
%10 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %9)
%11 = call i32 @bits(i32 12, i32 7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%12 = and i32 %5, 127
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 3.906200e+00
%15 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %14)
%16 = call i32 @bits(i32 6, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
ret void
}