#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);
int /*<<< orphan*/ strcpy(char *, char *);
void cc2400_agctst2(unsigned short v) {
  char description[64];
  bits(15, 14, "-", "W0", "");
  if (((v >> 12) & 3) == 0)
    strcpy(description, "Disabled");
  else
    sprintf(description, "%d Fixed/Variable enable", (v >> 12) & 3);
  bits(13, 12, "AGC_BACKEND_BLANKING", "RW", description);
  sprintf(description, "%d", (v >> 9) & 7);
  bits(11, 9, "AGC_ADJUST_M3DB", "RW", description);
  sprintf(description, "%d", (v >> 6) & 7);
  bits(8, 6, "AGC_ADJUST_M1DB", "RW", description);
  sprintf(description, "%d", (v >> 3) & 7);
  bits(5, 3, "AGC_ADJUST_P3DB", "RW", description);
  sprintf(description, "%d", v & 7);
  bits(2, 0, "AGC_ADJUST_P1DB", "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    0xeb0(%rip),%rdx
lea    0xeab(%rip),%rcx
lea    0xea3(%rip),%r8
call   1040 <bits@plt>
movzwl -0x2(%rbp),%eax
sar    $0xc,%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    118b <cc2400_agctst2+0x5b>
lea    -0x50(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11a8 <cc2400_agctst2+0x78>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0xc,%eax
and    $0x3,%eax
lea    0xe6e(%rip),%rsi
movzwl %ax,%edx
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xd,%edi
mov    $0xc,%esi
lea    0xe6a(%rip),%rdx
lea    0xe78(%rip),%rcx
call   1040 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x9,%eax
and    $0x7,%eax
lea    0xe61(%rip),%rsi
movzwl %ax,%edx
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0xb,%edi
mov    $0x9,%esi
lea    0xe47(%rip),%rdx
lea    0xe3a(%rip),%rcx
call   1040 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x6,%eax
and    $0x7,%eax
lea    0xe23(%rip),%rsi
movzwl %ax,%edx
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x8,%edi
mov    $0x6,%esi
lea    0xe19(%rip),%rdx
lea    0xdfc(%rip),%rcx
call   1040 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
sar    $0x3,%eax
and    $0x7,%eax
lea    0xde5(%rip),%rsi
movzwl %ax,%edx
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x5,%edi
mov    $0x3,%esi
lea    0xdeb(%rip),%rdx
lea    0xdbe(%rip),%rcx
call   1040 <bits@plt>
lea    -0x50(%rbp),%rdi
movzwl -0x2(%rbp),%eax
and    $0x7,%eax
lea    0xdaa(%rip),%rsi
movzwl %ax,%edx
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%r8
mov    $0x2,%edi
xor    %esi,%esi
lea    0xdc3(%rip),%rdx
lea    0xd86(%rip),%rcx
call   1040 <bits@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edi,%ebx
lea    0xebc(%rip),%rdx
lea    0xeb7(%rip),%rcx
lea    0xeaf(%rip),%r8
mov    $0xf,%edi
mov    $0xe,%esi
call   1040 <bits@plt>
mov    %ebx,%eax
shr    $0xc,%eax
and    $0x3,%ax
je     1180 <cc2400_agctst2+0x50>
movzwl %ax,%edx
lea    0xe98(%rip),%rsi
mov    %rsp,%rdi
call   1050 <sprintf@plt>
jmp    118f <cc2400_agctst2+0x5f>
lea    0xe7e(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xe91(%rip),%rdx
lea    0xe9f(%rip),%r14
mov    %rsp,%r15
mov    $0xd,%edi
mov    $0xc,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <bits@plt>
mov    %ebx,%edx
shr    $0x9,%edx
and    $0x7,%edx
lea    0xe7b(%rip),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xe6c(%rip),%rdx
mov    $0xb,%edi
mov    $0x9,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <bits@plt>
mov    %ebx,%edx
shr    $0x6,%edx
and    $0x7,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xe4d(%rip),%rdx
mov    $0x8,%edi
mov    $0x6,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <bits@plt>
mov    %ebx,%edx
shr    $0x3,%edx
and    $0x7,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xe2e(%rip),%rdx
mov    $0x5,%edi
mov    $0x3,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <bits@plt>
and    $0x7,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
lea    0xe12(%rip),%rdx
mov    $0x2,%edi
xor    %esi,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <bits@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 = [9 x i8] c"Disabled\00"
@.str.4 = [25 x i8] c"%d Fixed/Variable enable\00"
@.str.5 = [21 x i8] c"AGC_BACKEND_BLANKING\00"
@.str.6 = [3 x i8] c"RW\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [16 x i8] c"AGC_ADJUST_M3DB\00"
@.str.9 = [16 x i8] c"AGC_ADJUST_M1DB\00"
@.str.10 = [16 x i8] c"AGC_ADJUST_P3DB\00"
@.str.11 = [16 x i8] c"AGC_ADJUST_P1DB\00"
define void @cc2400_agctst2(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 = load i16, i16* %2
%6 = zext i16 %5 to i32
%7 = ashr i32 %6, 12
%8 = and i32 %7, 3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %21
13: ; preds = %1
%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, 12
%18 = and i32 %17, 3
%19 = trunc i32 %18 to i16
%20 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i16 zeroext %19)
br label %21
21: ; preds = %13, %10
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%23 = call i32 @bits(i32 13, i32 12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%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, 9
%28 = and i32 %27, 7
%29 = trunc i32 %28 to i16
%30 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, 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 11, i32 9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, 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 = ashr i32 %35, 6
%37 = and i32 %36, 7
%38 = trunc i32 %37 to i16
%39 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %38)
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%41 = call i32 @bits(i32 8, i32 6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%43 = load i16, i16* %2
%44 = zext i16 %43 to i32
%45 = ashr i32 %44, 3
%46 = and i32 %45, 7
%47 = trunc i32 %46 to i16
%48 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %47)
%49 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%50 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%52 = load i16, i16* %2
%53 = zext i16 %52 to i32
%54 = and i32 %53, 7
%55 = trunc i32 %54 to i16
%56 = call i32 @sprintf(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %55)
%57 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%58 = call i32 @bits(i32 2, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %57)
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 = [9 x i8] c"Disabled\00"
@.str.4 = [25 x i8] c"%d Fixed/Variable enable\00"
@.str.5 = [21 x i8] c"AGC_BACKEND_BLANKING\00"
@.str.6 = [3 x i8] c"RW\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [16 x i8] c"AGC_ADJUST_M3DB\00"
@.str.9 = [16 x i8] c"AGC_ADJUST_M1DB\00"
@.str.10 = [16 x i8] c"AGC_ADJUST_P3DB\00"
@.str.11 = [16 x i8] c"AGC_ADJUST_P1DB\00"
define void @cc2400_agctst2(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, 12
%6 = and i16 %5, 3
%7 = icmp eq i16 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i16 zeroext %6)
br label %12
12: ; preds = %10, %8
%13 = call i32 @bits(i32 13, i32 12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%14 = lshr i16 %0, 9
%15 = and i16 %14, 7
%16 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %15)
%17 = call i32 @bits(i32 11, i32 9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%18 = lshr i16 %0, 6
%19 = and i16 %18, 7
%20 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %19)
%21 = call i32 @bits(i32 8, i32 6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%22 = lshr i16 %0, 3
%23 = and i16 %22, 7
%24 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %23)
%25 = call i32 @bits(i32 5, i32 3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%26 = and i16 %0, 7
%27 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %26)
%28 = call i32 @bits(i32 2, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
ret void
}