#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_fsdiv(unsigned short v) {
  char description[64];
  sprintf(description, "fc = %d MHz", v & 0xfff);
  bits(15, 12, "-", "W0", "");
  bits(11, 10, "FREQ[11:10]", "RO", "");
  bits(9, 0, "FREQ[9:0]", "RW", description);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0xfff,%eax
lea    0xebd(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
mov    $0xf,%edi
mov    $0xc,%esi
lea    0xeb0(%rip),%rdx
lea    0xeab(%rip),%rcx
lea    0xea3(%rip),%r8
call   1030 <bits@plt>
mov    $0xb,%edi
mov    $0xa,%esi
lea    0xe91(%rip),%rdx
lea    0xe96(%rip),%rcx
lea    0xe7f(%rip),%r8
call   1030 <bits@plt>
lea    -0x50(%rbp),%r8
mov    $0x9,%edi
xor    %esi,%esi
lea    0xe7b(%rip),%rdx
lea    0xe7e(%rip),%rcx
call   1030 <bits@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %edi,%edx
and    $0xfff,%edx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
lea    0xec4(%rip),%rdx
lea    0xebf(%rip),%rcx
lea    0xeb7(%rip),%rbx
mov    $0xf,%edi
mov    $0xc,%esi
mov    %rbx,%r8
call   1030 <bits@plt>
lea    0xea2(%rip),%rdx
lea    0xea7(%rip),%rcx
mov    $0xb,%edi
mov    $0xa,%esi
mov    %rbx,%r8
call   1030 <bits@plt>
lea    0xe91(%rip),%rdx
lea    0xe94(%rip),%rcx
mov    $0x9,%edi
xor    %esi,%esi
mov    %r14,%r8
call   1030 <bits@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"fc = %d MHz\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"W0\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [12 x i8] c"FREQ[11:10]\00"
@.str.5 = [3 x i8] c"RO\00"
@.str.6 = [10 x i8] c"FREQ[9:0]\00"
@.str.7 = [3 x i8] c"RW\00"
define void @cc2400_fsdiv(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [64 x i8]
store i16 %0, i16* %2
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load i16, i16* %2
%6 = zext i16 %5 to i32
%7 = and i32 %6, 4095
%8 = trunc i32 %7 to i16
%9 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i16 zeroext %8)
%10 = call i32 @bits(i32 15, i32 12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @bits(i32 11, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%13 = call i32 @bits(i32 9, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"fc = %d MHz\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"W0\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [12 x i8] c"FREQ[11:10]\00"
@.str.5 = [3 x i8] c"RO\00"
@.str.6 = [10 x i8] c"FREQ[9:0]\00"
@.str.7 = [3 x i8] c"RW\00"
define void @cc2400_fsdiv(i16 zeroext %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = and i16 %0, 4095
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i16 zeroext %4)
%6 = tail call i32 @bits(i32 15, i32 12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @bits(i32 11, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @bits(i32 9, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %3)
ret void
}