#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_res26(unsigned short v) {
  char description[64];
  sprintf(description, "%d", (v >> 10) & 0x3F);
  bits(15, 10, "-", "RW", description);
  sprintf(description, "%d", v & 0x1FF);
  bits(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
sar    $0xa,%eax
and    $0x3f,%eax
lea    0xebc(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xf,%edi
mov    $0xa,%esi
lea    0xea2(%rip),%rdx
lea    0xe9d(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x1ff,%eax
lea    0xe7f(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x9,%edi
xor    %esi,%esi
lea    0xe68(%rip),%rdx
lea    0xe63(%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
mov    %edi,%edx
shr    $0xa,%edx
lea    0xec6(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xeb4(%rip),%r15
lea    0xeaf(%rip),%r12
mov    $0xf,%edi
mov    $0xa,%esi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
and    $0x1ff,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    $0x9,%edi
xor    %esi,%esi
mov    %r15,%rdx
mov    %r12,%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 = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"RW\00"
define void @cc2400_res26(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 = ashr i32 %6, 10
%8 = and i32 %7, 63
%9 = trunc i32 %8 to i16
%10 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %9)
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%12 = call i32 @bits(i32 15, i32 10, 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* %11)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%14 = load i16, i16* %2
%15 = zext i16 %14 to i32
%16 = and i32 %15, 511
%17 = trunc i32 %16 to i16
%18 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %17)
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%20 = call i32 @bits(i32 9, i32 0, 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* %19)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"RW\00"
define void @cc2400_res26(i16 zeroext %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = lshr i16 %0, 10
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %4)
%6 = call i32 @bits(i32 15, i32 10, 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* %3)
%7 = and i16 %0, 511
%8 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %7)
%9 = call i32 @bits(i32 9, i32 0, 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* %3)
ret void
}