#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_setAirDataRate(int rate) {
  int rfSetup;
  rfSetup = nRF24L01P_getRegister(0x06) & ~((1 << 5) | (1 << 3));
  switch (rate) {
  case 250:
    rfSetup |= ((1 << 5));
    break;
  case 1000:
    rfSetup |= (0);
    break;
  case 2000:
    rfSetup |= ((1 << 3));
    break;
  default:
    printf("nRF24L01P: Invalid Air Data Rate setting %d\r\n", rate);
    return;
  }
  nRF24L01P_setRegister(0x06, rfSetup);
}


x86 assembly (clang, -O0):
<nRF24L01P_setAirDataRate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x6,%edi
call   1050 <nRF24L01P_getRegister@plt>
and    $0xffffffd7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xfa,%eax
je     1187 <nRF24L01P_setAirDataRate+0x57>
jmp    1161 <nRF24L01P_setAirDataRate+0x31>
mov    -0xc(%rbp),%eax
sub    $0x3e8,%eax
je     1195 <nRF24L01P_setAirDataRate+0x65>
jmp    1174 <nRF24L01P_setAirDataRate+0x44>
mov    -0xc(%rbp),%eax
sub    $0x7d0,%eax
je     11a3 <nRF24L01P_setAirDataRate+0x73>
jmp    11b1 <nRF24L01P_setAirDataRate+0x81>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <nRF24L01P_setAirDataRate+0x95>
mov    -0x8(%rbp),%eax
or     $0x0,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <nRF24L01P_setAirDataRate+0x95>
mov    -0x8(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <nRF24L01P_setAirDataRate+0x95>
mov    -0x4(%rbp),%esi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
jmp    11d2 <nRF24L01P_setAirDataRate+0xa2>
mov    -0x8(%rbp),%esi
mov    $0x6,%edi
call   1040 <nRF24L01P_setRegister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nRF24L01P_setAirDataRate>:
push   %rbx
mov    %edi,%ebx
mov    $0x6,%edi
call   1050 <nRF24L01P_getRegister@plt>
and    $0xffffffd7,%eax
cmp    $0x7d0,%ebx
je     115d <nRF24L01P_setAirDataRate+0x2d>
cmp    $0x3e8,%ebx
je     1160 <nRF24L01P_setAirDataRate+0x30>
cmp    $0xfa,%ebx
jne    116d <nRF24L01P_setAirDataRate+0x3d>
or     $0x20,%eax
jmp    1160 <nRF24L01P_setAirDataRate+0x30>
or     $0x8,%eax
mov    $0x6,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <nRF24L01P_setRegister@plt>
lea    0xe8c(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"nRF24L01P: Invalid Air Data Rate setting %d\0D\0A\00"
define void @nRF24L01P_setAirDataRate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @nRF24L01P_getRegister(i32 6)
%5 = and i32 %4, -41
store i32 %5, i32* %3
%6 = load i32, i32* %2
switch i32 %6, label %16 [
i32 250, label %7
i32 1000, label %10
i32 2000, label %13
]
7: ; preds = %1
%8 = load i32, i32* %3
%9 = or i32 %8, 32
store i32 %9, i32* %3
br label %19
10: ; preds = %1
%11 = load i32, i32* %3
%12 = or i32 %11, 0
store i32 %12, i32* %3
br label %19
13: ; preds = %1
%14 = load i32, i32* %3
%15 = or i32 %14, 8
store i32 %15, i32* %3
br label %19
16: ; preds = %1
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 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 6, i32 %20)
br label %22
22: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"nRF24L01P: Invalid Air Data Rate setting %d\0D\0A\00"
define void @nRF24L01P_setAirDataRate(i32 %0) {
%2 = tail call i32 @nRF24L01P_getRegister(i32 6)
%3 = and i32 %2, -41
switch i32 %0, label %8 [
i32 250, label %4
i32 1000, label %10
i32 2000, label %6
]
4: ; preds = %1
%5 = or i32 %3, 32
br label %10
6: ; preds = %1
%7 = or i32 %3, 8
br label %10
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 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 6, i32 %11)
br label %13
13: ; preds = %10, %8
ret void
}