#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_getTransferSize(int pipe) {
  int rxPwPxRegister;
  int size;
  if ((pipe < 0) || (pipe > 5)) {
    printf("nRF24L01P: Invalid Transfer Size pipe number %d\r\n", pipe);
    return 0;
  }
  rxPwPxRegister = 0x11 + (pipe - 0);
  size = nRF24L01P_getRegister(rxPwPxRegister);
  return (size & 0x3F);
}


x86 assembly (clang, -O0):
<nRF24L01P_getTransferSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     113f <nRF24L01P_getTransferSize+0x1f>
cmpl   $0x5,-0x8(%rbp)
jle    115a <nRF24L01P_getTransferSize+0x3a>
mov    -0x8(%rbp),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    117a <nRF24L01P_getTransferSize+0x5a>
mov    -0x8(%rbp),%eax
sub    $0x0,%eax
add    $0x11,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <nRF24L01P_getRegister@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nRF24L01P_getTransferSize>:
push   %rax
mov    %edi,%esi
cmp    $0x6,%edi
jb     1138 <nRF24L01P_getTransferSize+0x18>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
add    $0x11,%esi
mov    %esi,%edi
call   1040 <nRF24L01P_getRegister@plt>
and    $0x3f,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"nRF24L01P: Invalid Transfer Size pipe number %d\0D\0A\00"
define i32 @nRF24L01P_getTransferSize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 5
br i1 %10, label %11, label %14
11: ; preds = %8, %1
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 0, i32* %2
br label %22
14: ; preds = %8
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 0
%17 = add nsw i32 17, %16
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = call i32 @nRF24L01P_getRegister(i32 %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = and i32 %20, 63
store i32 %21, i32* %2
br label %22
22: ; preds = %14, %11
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [50 x i8] c"nRF24L01P: Invalid Transfer Size pipe number %d\0D\0A\00"
define i32 @nRF24L01P_getTransferSize(i32 %0) {
%2 = icmp ugt i32 %0, 5
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
5: ; preds = %1
%6 = add nuw nsw i32 %0, 17
%7 = tail call i32 @nRF24L01P_getRegister(i32 %6)
%8 = and i32 %7, 63
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ 0, %3 ], [ %8, %5 ]
ret i32 %10
}