#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*/ nRF24L01P_setRegister(int, int);
int /*<<< orphan*/ printf(char *, int);
void nRF24L01P_setCrcWidth(int width) {
  int config;
  config = nRF24L01P_getRegister(0x00) & ~((1 << 3) | (1 << 2));
  switch (width) {
  case 0:
    config |= (0);
    break;
  case 8:
    config |= ((1 << 3));
    break;
  case 16:
    config |= ((1 << 3) | (1 << 2));
    break;
  default:
    printf("nRF24L01P: Invalid CRC Width setting %d\r\n", width);
    return;
  }
  nRF24L01P_setRegister(0x00, config);
}


x86 assembly (clang, -O0):
<nRF24L01P_setCrcWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1050 <nRF24L01P_getRegister@plt>
and    $0xfffffff3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     117d <nRF24L01P_setCrcWidth+0x4d>
jmp    115b <nRF24L01P_setCrcWidth+0x2b>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     118b <nRF24L01P_setCrcWidth+0x5b>
jmp    116c <nRF24L01P_setCrcWidth+0x3c>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     1199 <nRF24L01P_setCrcWidth+0x69>
jmp    11a7 <nRF24L01P_setCrcWidth+0x77>
mov    -0x8(%rbp),%eax
or     $0x0,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <nRF24L01P_setCrcWidth+0x8b>
mov    -0x8(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <nRF24L01P_setCrcWidth+0x8b>
mov    -0x8(%rbp),%eax
or     $0xc,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <nRF24L01P_setCrcWidth+0x8b>
mov    -0x4(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <nRF24L01P_setCrcWidth+0x95>
mov    -0x8(%rbp),%esi
xor    %edi,%edi
call   1040 <nRF24L01P_setRegister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nRF24L01P_setCrcWidth>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1050 <nRF24L01P_getRegister@plt>
mov    %eax,%esi
and    $0xfffffff3,%esi
test   %ebx,%ebx
je     1157 <nRF24L01P_setCrcWidth+0x27>
cmp    $0x10,%ebx
je     1152 <nRF24L01P_setCrcWidth+0x22>
cmp    $0x8,%ebx
jne    115f <nRF24L01P_setCrcWidth+0x2f>
or     $0x8,%esi
jmp    1157 <nRF24L01P_setCrcWidth+0x27>
or     $0xc,%eax
mov    %eax,%esi
xor    %edi,%edi
pop    %rbx
jmp    1040 <nRF24L01P_setRegister@plt>
lea    0xe9a(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"nRF24L01P: Invalid CRC Width setting %d\0D\0A\00"
define void @nRF24L01P_setCrcWidth(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @nRF24L01P_getRegister(i32 0)
%5 = and i32 %4, -13
store i32 %5, i32* %3
%6 = load i32, i32* %2
switch i32 %6, label %16 [
i32 0, label %7
i32 8, label %10
i32 16, label %13
]
7: ; preds = %1
%8 = load i32, i32* %3
%9 = or i32 %8, 0
store i32 %9, i32* %3
br label %19
10: ; preds = %1
%11 = load i32, i32* %3
%12 = or i32 %11, 8
store i32 %12, i32* %3
br label %19
13: ; preds = %1
%14 = load i32, i32* %3
%15 = or i32 %14, 12
store i32 %15, i32* %3
br label %19
16: ; preds = %1
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %22
19: ; preds = %13, %10, %7
%20 = load i32, i32* %3
%21 = call i32 @nRF24L01P_setRegister(i32 0, i32 %20)
br label %22
22: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"nRF24L01P: Invalid CRC Width setting %d\0D\0A\00"
define void @nRF24L01P_setCrcWidth(i32 %0) {
%2 = tail call i32 @nRF24L01P_getRegister(i32 0)
%3 = and i32 %2, -13
switch i32 %0, label %8 [
i32 0, label %10
i32 8, label %4
i32 16, label %6
]
4: ; preds = %1
%5 = or i32 %3, 8
br label %10
6: ; preds = %1
%7 = or i32 %2, 12
br label %10
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %13
10: ; preds = %1, %6, %4
%11 = phi i32 [ %7, %6 ], [ %5, %4 ], [ %3, %1 ]
%12 = tail call i32 @nRF24L01P_setRegister(i32 0, i32 %11)
br label %13
13: ; preds = %10, %8
ret void
}