#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 *);
void cc2400_fsmstate(unsigned short v) {
  bits(15, 13, "-", "W0", "");
  bits(12, 8, "FSM_STATE_BKPT", "RW", ((v >> 8) & 0xF) == 0 ? "disabled" : "");
  bits(7, 5, "-", "W0", "");
  bits(4, 0, "FSM_CUR_STATE", "RO", "");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0xf,%edi
mov    $0xd,%esi
lea    0xed0(%rip),%rdx
lea    0xecb(%rip),%rcx
lea    0xec3(%rip),%r8
call   1030 <bits@plt>
movzwl -0x2(%rbp),%ecx
sar    $0x8,%ecx
and    $0xf,%ecx
lea    0xead(%rip),%r8
lea    0xebc(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%r8
mov    $0xc,%edi
mov    $0x8,%esi
lea    0xe92(%rip),%rdx
lea    0xe9a(%rip),%rcx
call   1030 <bits@plt>
mov    $0x7,%edi
mov    $0x5,%esi
lea    0xe70(%rip),%rdx
lea    0xe6b(%rip),%rcx
lea    0xe63(%rip),%r8
call   1030 <bits@plt>
mov    $0x4,%edi
xor    %esi,%esi
lea    0xe6f(%rip),%rdx
lea    0xe76(%rip),%rcx
lea    0xe42(%rip),%r8
call   1030 <bits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xee0(%rip),%r14
lea    0xedb(%rip),%r15
lea    0xed3(%rip),%rbx
mov    $0xf,%edi
mov    $0xd,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
test   $0xf00,%ebp
lea    0xec4(%rip),%r8
cmovne %rbx,%r8
lea    0xea7(%rip),%rdx
lea    0xeaf(%rip),%rcx
mov    $0xc,%edi
mov    $0x8,%esi
call   1030 <bits@plt>
mov    $0x7,%edi
mov    $0x5,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1030 <bits@plt>
lea    0xe8d(%rip),%rdx
lea    0xe94(%rip),%rcx
mov    $0x4,%edi
xor    %esi,%esi
mov    %rbx,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <bits@plt>

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 = [15 x i8] c"FSM_STATE_BKPT\00"
@.str.4 = [3 x i8] c"RW\00"
@.str.5 = [9 x i8] c"disabled\00"
@.str.6 = [14 x i8] c"FSM_CUR_STATE\00"
@.str.7 = [3 x i8] c"RO\00"
define void @cc2400_fsmstate(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i32 @bits(i32 15, i32 13, 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))
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = ashr i32 %5, 8
%7 = and i32 %6, 15
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @bits(i32 12, i32 8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = call i32 @bits(i32 7, i32 5, 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))
%13 = call i32 @bits(i32 4, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
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 = [15 x i8] c"FSM_STATE_BKPT\00"
@.str.4 = [3 x i8] c"RW\00"
@.str.5 = [9 x i8] c"disabled\00"
@.str.6 = [14 x i8] c"FSM_CUR_STATE\00"
@.str.7 = [3 x i8] c"RO\00"
define void @cc2400_fsmstate(i16 zeroext %0) {
%2 = tail call i32 @bits(i32 15, i32 13, 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))
%3 = and i16 %0, 3840
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%6 = tail call i32 @bits(i32 12, i32 8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%7 = tail call i32 @bits(i32 7, i32 5, 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))
%8 = tail call i32 @bits(i32 4, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}