#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 nRF24L01P_getRegister(int);
int /*<<< orphan*/ printf(char *, int);
int nRF24L01P_getCrcWidth(void) {
  int crcWidth;
  crcWidth = nRF24L01P_getRegister(0x00) & ((1 << 3) | (1 << 2));
  switch (crcWidth) {
  case (0):
    return 0;
  case ((1 << 3)):
    return 8;
  case ((1 << 3) | (1 << 2)):
    return 16;
  default:
    printf("nRF24L01P: Unknown CRC Width value %d\r\n", crcWidth);
    return 0;
  }
}


x86 assembly (clang, -O0):
<nRF24L01P_getCrcWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <nRF24L01P_getRegister@plt>
and    $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     116a <nRF24L01P_getCrcWidth+0x4a>
jmp    1148 <nRF24L01P_getCrcWidth+0x28>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     1176 <nRF24L01P_getCrcWidth+0x56>
jmp    1159 <nRF24L01P_getCrcWidth+0x39>
mov    -0xc(%rbp),%eax
sub    $0xc,%eax
je     1182 <nRF24L01P_getCrcWidth+0x62>
jmp    118e <nRF24L01P_getCrcWidth+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <nRF24L01P_getCrcWidth+0x84>
movl   $0x8,-0x4(%rbp)
jmp    11a4 <nRF24L01P_getCrcWidth+0x84>
movl   $0x10,-0x4(%rbp)
jmp    11a4 <nRF24L01P_getCrcWidth+0x84>
mov    -0x8(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nRF24L01P_getCrcWidth>:
push   %rax
xor    %edi,%edi
call   1040 <nRF24L01P_getRegister@plt>
and    $0xc,%eax
je     1155 <nRF24L01P_getCrcWidth+0x35>
cmp    $0xc,%eax
je     113e <nRF24L01P_getCrcWidth+0x1e>
cmp    $0x8,%eax
jne    1145 <nRF24L01P_getCrcWidth+0x25>
mov    $0x8,%eax
pop    %rcx
ret
mov    $0x10,%eax
pop    %rcx
ret
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"nRF24L01P: Unknown CRC Width value %d\0D\0A\00"
define i32 @nRF24L01P_getCrcWidth() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @nRF24L01P_getRegister(i32 0)
%4 = and i32 %3, 12
store i32 %4, i32* %2
%5 = load i32, i32* %2
switch i32 %5, label %9 [
i32 0, label %6
i32 8, label %7
i32 12, label %8
]
6: ; preds = %0
store i32 0, i32* %1
br label %12
7: ; preds = %0
store i32 8, i32* %1
br label %12
8: ; preds = %0
store i32 16, i32* %1
br label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 0, i32* %1
br label %12
12: ; preds = %9, %8, %7, %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [40 x i8] c"nRF24L01P: Unknown CRC Width value %d\0D\0A\00"
define i32 @nRF24L01P_getCrcWidth() {
%1 = tail call i32 @nRF24L01P_getRegister(i32 0)
%2 = and i32 %1, 12
switch i32 %2, label %5 [
i32 0, label %7
i32 8, label %3
i32 12, label %4
]
3: ; preds = %0
br label %7
4: ; preds = %0
br label %7
5: ; preds = %0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %0, %5, %4, %3
%8 = phi i32 [ 0, %5 ], [ 16, %4 ], [ 8, %3 ], [ %2, %0 ]
ret i32 %8
}