#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 *, unsigned short);
void cc2400_fstst1(unsigned short v) {
  char description[64];
  bits(15, 15, "RXBPF_LOCUR", "RW", (v & 0x8000) ? "3uA" : "4uA");
  bits(14, 14, "RXBPF_MIDCUR", "RW", (v & 0x4000) ? "3uA" : "4uA");
  sprintf(description, "%d", (v >> 10) & 0xF);
  bits(13, 10, "VCO_CURRENT_REF", "RW", description);
  sprintf(description, "%d", (v >> 4) & 0x3F);
  bits(9, 4, "VCO_CURRENT_K", "RW", description);
  bits(3, 3, "VCO_DAC_EN", "RW", "");
  sprintf(description, "%d", v & 0x3);
  bits(2, 0, "VCO_DAC_VAL", "RW", "");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
and    $0x8000,%ecx
lea    0xed3(%rip),%r8
lea    0xec8(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%r8
mov    $0xf,%esi
lea    0xea6(%rip),%rdx
lea    0xeab(%rip),%rcx
mov    %esi,%edi
call   1030 <bits@plt>
movzwl -0x2(%rbp),%ecx
and    $0x4000,%ecx
lea    0xe9a(%rip),%r8
lea    0xe8f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%r8
mov    $0xe,%esi
lea    0xe84(%rip),%rdx
lea    0xe72(%rip),%rcx
mov    %esi,%edi
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0xa,%eax
and    $0xf,%eax
lea    0xe6e(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xd,%edi
mov    $0xa,%esi
lea    0xe54(%rip),%rdx
lea    0xe32(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x4,%eax
and    $0x3f,%eax
lea    0xe30(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x9,%edi
mov    $0x4,%esi
lea    0xe26(%rip),%rdx
lea    0xdf4(%rip),%rcx
call   1030 <bits@plt>
mov    $0x3,%esi
lea    0xe1c(%rip),%rdx
lea    0xddc(%rip),%rcx
lea    0xddb(%rip),%r8
mov    %esi,%edi
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x3,%eax
lea    0xdd4(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
mov    $0x2,%edi
xor    %esi,%esi
lea    0xdea(%rip),%rdx
lea    0xd9f(%rip),%rcx
lea    0xd9e(%rip),%r8
call   1030 <bits@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebp
test   $0x8000,%edi
lea    0xed8(%rip),%r14
lea    0xecd(%rip),%rbx
mov    %rbx,%r8
cmove  %r14,%r8
lea    0xeb0(%rip),%rdx
lea    0xeb5(%rip),%r15
mov    $0xf,%edi
mov    $0xf,%esi
mov    %r15,%rcx
call   1030 <bits@plt>
test   $0x4000,%ebp
cmove  %r14,%rbx
lea    0xe9d(%rip),%rdx
mov    $0xe,%edi
mov    $0xe,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0xa,%edx
and    $0xf,%edx
lea    0xe86(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe74(%rip),%rdx
mov    $0xd,%edi
mov    $0xa,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0x4,%edx
and    $0x3f,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe55(%rip),%rdx
mov    $0x9,%edi
mov    $0x4,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
lea    0xe47(%rip),%rdx
lea    0xe0d(%rip),%r12
mov    $0x3,%edi
mov    $0x3,%esi
mov    %r15,%rcx
mov    %r12,%r8
call   1030 <bits@plt>
and    $0x3,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
lea    0xe1f(%rip),%rdx
mov    $0x2,%edi
xor    %esi,%esi
mov    %r15,%rcx
mov    %r12,%r8
call   1030 <bits@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"RXBPF_LOCUR\00"
@.str.1 = [3 x i8] c"RW\00"
@.str.2 = [4 x i8] c"3uA\00"
@.str.3 = [4 x i8] c"4uA\00"
@.str.4 = [13 x i8] c"RXBPF_MIDCUR\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [16 x i8] c"VCO_CURRENT_REF\00"
@.str.7 = [14 x i8] c"VCO_CURRENT_K\00"
@.str.8 = [11 x i8] c"VCO_DAC_EN\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [12 x i8] c"VCO_DAC_VAL\00"
define void @cc2400_fstst1(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [64 x i8]
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = and i32 %5, 32768
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%10 = call i32 @bits(i32 15, i32 15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i16, i16* %2
%12 = zext i16 %11 to i32
%13 = and i32 %12, 16384
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%17 = call i32 @bits(i32 14, i32 14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%19 = load i16, i16* %2
%20 = zext i16 %19 to i32
%21 = ashr i32 %20, 10
%22 = and i32 %21, 15
%23 = trunc i32 %22 to i16
%24 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %23)
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%26 = call i32 @bits(i32 13, i32 10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%28 = load i16, i16* %2
%29 = zext i16 %28 to i32
%30 = ashr i32 %29, 4
%31 = and i32 %30, 63
%32 = trunc i32 %31 to i16
%33 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %32)
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%35 = call i32 @bits(i32 9, i32 4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = call i32 @bits(i32 3, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, 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.9, i64 0, i64 0))
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%38 = load i16, i16* %2
%39 = zext i16 %38 to i32
%40 = and i32 %39, 3
%41 = trunc i32 %40 to i16
%42 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %41)
%43 = call i32 @bits(i32 2, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, 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.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"RXBPF_LOCUR\00"
@.str.1 = [3 x i8] c"RW\00"
@.str.2 = [4 x i8] c"3uA\00"
@.str.3 = [4 x i8] c"4uA\00"
@.str.4 = [13 x i8] c"RXBPF_MIDCUR\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [16 x i8] c"VCO_CURRENT_REF\00"
@.str.7 = [14 x i8] c"VCO_CURRENT_K\00"
@.str.8 = [11 x i8] c"VCO_DAC_EN\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [12 x i8] c"VCO_DAC_VAL\00"
define void @cc2400_fstst1(i16 zeroext %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = zext i16 %0 to i32
%5 = and i32 %4, 32768
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @bits(i32 15, i32 15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = and i32 %4, 16384
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%12 = tail call i32 @bits(i32 14, i32 14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = lshr i16 %0, 10
%14 = and i16 %13, 15
%15 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %14)
%16 = call i32 @bits(i32 13, i32 10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%17 = lshr i16 %0, 4
%18 = and i16 %17, 63
%19 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %18)
%20 = call i32 @bits(i32 9, i32 4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%21 = call i32 @bits(i32 3, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, 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.9, i64 0, i64 0))
%22 = and i16 %0, 3
%23 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %22)
%24 = call i32 @bits(i32 2, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, 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.9, i64 0, i64 0))
ret void
}