#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_fsmtc(unsigned short v) {
  char description[64];
  sprintf(description, "%d us", 5 * ((v >> 13) & 0x7));
  bits(15, 13, "TC_RXON2AGCEN", "RW", description);
  sprintf(description, "%d us", (v >> 10) & 0x7);
  bits(12, 10, "TC_PAON2AGCEN", "RW", description);
  bits(9, 6, "-", "RW", "");
  sprintf(description, "%d us", (v >> 3) & 0x7);
  bits(5, 3, "END2SWITCH", "RW", description);
  sprintf(description, "%d us", v & 0x7);
  bits(5, 3, "TC_TXEND2PAOFF", "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    $0xd,%eax
and    $0x7,%eax
imul   $0x5,%eax,%eax
lea    0xeb9(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xf,%edi
mov    $0xd,%esi
lea    0xea2(%rip),%rdx
lea    0xea9(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0xa,%eax
and    $0x7,%eax
lea    0xe7b(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xc,%edi
mov    $0xa,%esi
lea    0xe75(%rip),%rdx
lea    0xe6b(%rip),%rcx
call   1030 <bits@plt>
mov    $0x9,%edi
mov    $0x6,%esi
lea    0xe66(%rip),%rdx
lea    0xe4e(%rip),%rcx
lea    0xe59(%rip),%r8
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x3,%eax
and    $0x7,%eax
lea    0xe19(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x5,%edi
mov    $0x3,%esi
lea    0xe23(%rip),%rdx
lea    0xe09(%rip),%rcx
call   1030 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x7,%eax
lea    0xdde(%rip),%rsi
movzwl %ax,%edx
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x5,%edi
mov    $0x3,%esi
lea    0xdf3(%rip),%rdx
lea    0xdce(%rip),%rcx
call   1030 <bits@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %edi,%ebp
mov    %edi,%eax
shr    $0xd,%eax
lea    (%rax,%rax,4),%eax
movzwl %ax,%edx
lea    0xec2(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xeb3(%rip),%rdx
lea    0xeba(%rip),%r15
mov    $0xf,%edi
mov    $0xd,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0xa,%edx
and    $0x7,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe8e(%rip),%rdx
mov    $0xc,%edi
mov    $0xa,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
lea    0xe80(%rip),%rdx
lea    0xe7a(%rip),%r8
mov    $0x9,%edi
mov    $0x6,%esi
mov    %r15,%rcx
call   1030 <bits@plt>
mov    %ebp,%edx
shr    $0x3,%edx
and    $0x7,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe4f(%rip),%rdx
mov    $0x5,%edi
mov    $0x3,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
and    $0x7,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
lea    0xe2e(%rip),%rdx
mov    $0x5,%edi
mov    $0x3,%esi
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d us\00"
@.str.1 = [14 x i8] c"TC_RXON2AGCEN\00"
@.str.2 = [3 x i8] c"RW\00"
@.str.3 = [14 x i8] c"TC_PAON2AGCEN\00"
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [11 x i8] c"END2SWITCH\00"
@.str.7 = [15 x i8] c"TC_TXEND2PAOFF\00"
define void @cc2400_fsmtc(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, 13
%8 = and i32 %7, 7
%9 = mul nsw i32 5, %8
%10 = trunc i32 %9 to i16
%11 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, 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 15, i32 13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, 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, 10
%18 = and i32 %17, 7
%19 = trunc i32 %18 to i16
%20 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, 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 12, i32 10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = call i32 @bits(i32 9, i32 6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, 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.5, i64 0, i64 0))
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%25 = load i16, i16* %2
%26 = zext i16 %25 to i32
%27 = ashr i32 %26, 3
%28 = and i32 %27, 7
%29 = trunc i32 %28 to i16
%30 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %29)
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%32 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%34 = load i16, i16* %2
%35 = zext i16 %34 to i32
%36 = and i32 %35, 7
%37 = trunc i32 %36 to i16
%38 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %37)
%39 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%40 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %39)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d us\00"
@.str.1 = [14 x i8] c"TC_RXON2AGCEN\00"
@.str.2 = [3 x i8] c"RW\00"
@.str.3 = [14 x i8] c"TC_PAON2AGCEN\00"
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [11 x i8] c"END2SWITCH\00"
@.str.7 = [15 x i8] c"TC_TXEND2PAOFF\00"
define void @cc2400_fsmtc(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, 13
%5 = mul nuw nsw i16 %4, 5
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %5)
%7 = call i32 @bits(i32 15, i32 13, i8* getelementptr inbounds ([14 x i8], [14 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)
%8 = lshr i16 %0, 10
%9 = and i16 %8, 7
%10 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %9)
%11 = call i32 @bits(i32 12, i32 10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%12 = call i32 @bits(i32 9, i32 6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, 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.5, i64 0, i64 0))
%13 = lshr i16 %0, 3
%14 = and i16 %13, 7
%15 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %14)
%16 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%17 = and i16 %0, 7
%18 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i16 zeroext %17)
%19 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}