#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_res24(unsigned short v) {
  char description[64];
  bits(15, 14, "-", "W0", "");
  sprintf(description, "%d", (v >> 10) & 0xF);
  bits(13, 10, "-", "RW", description);
  sprintf(description, "%d", (v >> 7) & 0x7);
  bits(9, 7, "-", "RW", description);
  sprintf(description, "%d", v & 0x3F);
  bits(6, 0, "-", "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    $0xe,%esi
lea    0xec0(%rip),%rdx
lea    0xebb(%rip),%rcx
lea    0xeb3(%rip),%r8
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0xa,%eax
and    $0xf,%eax
lea    0xe9d(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xd,%edi
mov    $0xa,%esi
lea    0xe7b(%rip),%rdx
lea    0xe7c(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x7,%eax
and    $0x7,%eax
lea    0xe5f(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x9,%edi
mov    $0x7,%esi
lea    0xe3d(%rip),%rdx
lea    0xe3e(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x3f,%eax
lea    0xe24(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x6,%edi
xor    %esi,%esi
lea    0xe05(%rip),%rdx
lea    0xe06(%rip),%rcx
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
lea    0xecb(%rip),%r14
lea    0xec6(%rip),%rcx
lea    0xebe(%rip),%r8
mov    $0xf,%edi
mov    $0xe,%esi
mov    %r14,%rdx
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0xa,%edx
and    $0xf,%edx
lea    0xea1(%rip),%r12
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <sprintf@plt>
lea    0xe8f(%rip),%r15
mov    $0xd,%edi
mov    $0xa,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0x7,%edx
and    $0x7,%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <sprintf@plt>
mov    $0x9,%edi
mov    $0x7,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
and    $0x3f,%ebp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    $0x6,%edi
xor    %esi,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
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 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"RW\00"
define void @cc2400_res24(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [64 x i8]
store i16 %0, i16* %2
%4 = call i32 @bits(i32 15, i32 14, 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, 10
%9 = and i32 %8, 15
%10 = trunc i32 %9 to i16
%11 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %10)
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%13 = call i32 @bits(i32 13, i32 10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%15 = load i16, i16* %2
%16 = zext i16 %15 to i32
%17 = ashr i32 %16, 7
%18 = and i32 %17, 7
%19 = trunc i32 %18 to i16
%20 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %19)
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%22 = call i32 @bits(i32 9, i32 7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%24 = load i16, i16* %2
%25 = zext i16 %24 to i32
%26 = and i32 %25, 63
%27 = trunc i32 %26 to i16
%28 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %27)
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%30 = call i32 @bits(i32 6, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %29)
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 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"RW\00"
define void @cc2400_res24(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 14, 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 = lshr i16 %0, 10
%6 = and i16 %5, 15
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %6)
%8 = call i32 @bits(i32 13, i32 10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%9 = lshr i16 %0, 7
%10 = and i16 %9, 7
%11 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %10)
%12 = call i32 @bits(i32 9, i32 7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%13 = and i16 %0, 63
%14 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %13)
%15 = call i32 @bits(i32 6, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
ret void
}