#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*/ RF_reset();
int /*<<< orphan*/ write_ZIGBEE_long(int, int);
void set_channel(short int channel_number) {
  if ((channel_number > 26) || (channel_number < 11))
    channel_number = 11;
  switch (channel_number) {
  case 11:
    write_ZIGBEE_long(0x200, 0x02);
    break;
  case 12:
    write_ZIGBEE_long(0x200, 0x12);
    break;
  case 13:
    write_ZIGBEE_long(0x200, 0x22);
    break;
  case 14:
    write_ZIGBEE_long(0x200, 0x32);
    break;
  case 15:
    write_ZIGBEE_long(0x200, 0x42);
    break;
  case 16:
    write_ZIGBEE_long(0x200, 0x52);
    break;
  case 17:
    write_ZIGBEE_long(0x200, 0x62);
    break;
  case 18:
    write_ZIGBEE_long(0x200, 0x72);
    break;
  case 19:
    write_ZIGBEE_long(0x200, 0x82);
    break;
  case 20:
    write_ZIGBEE_long(0x200, 0x92);
    break;
  case 21:
    write_ZIGBEE_long(0x200, 0xA2);
    break;
  case 22:
    write_ZIGBEE_long(0x200, 0xB2);
    break;
  case 23:
    write_ZIGBEE_long(0x200, 0xC2);
    break;
  case 24:
    write_ZIGBEE_long(0x200, 0xD2);
    break;
  case 25:
    write_ZIGBEE_long(0x200, 0xE2);
    break;
  case 26:
    write_ZIGBEE_long(0x200, 0xF2);
    break;
  }
  RF_reset();
}


x86 assembly (clang, -O0):
<set_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x1a,%eax
jg     1149 <set_channel+0x29>
movswl -0x2(%rbp),%eax
cmp    $0xb,%eax
jge    114f <set_channel+0x2f>
movw   $0xb,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0xfffffff5,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xf,%eax
ja     12b4 <set_channel+0x194>
mov    -0x10(%rbp),%rax
lea    0xe90(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x200,%edi
mov    $0x2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x12,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x22,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x32,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x42,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x52,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x62,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x72,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x82,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0x92,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xa2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xb2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xc2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xd2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xe2,%esi
call   1040 <write_ZIGBEE_long@plt>
jmp    12b4 <set_channel+0x194>
mov    $0x200,%edi
mov    $0xf2,%esi
call   1040 <write_ZIGBEE_long@plt>
mov    $0x0,%al
call   1030 <RF_reset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_channel>:
lea    -0x1b(%rdi),%ecx
add    $0xfffffff5,%edi
xor    %eax,%eax
cmp    $0xfff0,%cx
cmovae %edi,%eax
cmp    $0xf,%ax
ja     114d <set_channel+0x2d>
push   %rax
movzwl %ax,%esi
shl    $0x4,%esi
or     $0x2,%esi
mov    $0x200,%edi
call   1040 <write_ZIGBEE_long@plt>
add    $0x8,%rsp
xor    %eax,%eax
jmp    1030 <RF_reset@plt>

LLVM IR (-O0):
define void @set_channel(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = icmp sgt i32 %4, 26
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = icmp slt i32 %8, 11
br i1 %9, label %10, label %11
10: ; preds = %6, %1
store i16 11, i16* %2
br label %11
11: ; preds = %10, %6
%12 = load i16, i16* %2
%13 = sext i16 %12 to i32
switch i32 %13, label %46 [
i32 11, label %14
i32 12, label %16
i32 13, label %18
i32 14, label %20
i32 15, label %22
i32 16, label %24
i32 17, label %26
i32 18, label %28
i32 19, label %30
i32 20, label %32
i32 21, label %34
i32 22, label %36
i32 23, label %38
i32 24, label %40
i32 25, label %42
i32 26, label %44
]
14: ; preds = %11
%15 = call i32 @write_ZIGBEE_long(i32 512, i32 2)
br label %46
16: ; preds = %11
%17 = call i32 @write_ZIGBEE_long(i32 512, i32 18)
br label %46
18: ; preds = %11
%19 = call i32 @write_ZIGBEE_long(i32 512, i32 34)
br label %46
20: ; preds = %11
%21 = call i32 @write_ZIGBEE_long(i32 512, i32 50)
br label %46
22: ; preds = %11
%23 = call i32 @write_ZIGBEE_long(i32 512, i32 66)
br label %46
24: ; preds = %11
%25 = call i32 @write_ZIGBEE_long(i32 512, i32 82)
br label %46
26: ; preds = %11
%27 = call i32 @write_ZIGBEE_long(i32 512, i32 98)
br label %46
28: ; preds = %11
%29 = call i32 @write_ZIGBEE_long(i32 512, i32 114)
br label %46
30: ; preds = %11
%31 = call i32 @write_ZIGBEE_long(i32 512, i32 130)
br label %46
32: ; preds = %11
%33 = call i32 @write_ZIGBEE_long(i32 512, i32 146)
br label %46
34: ; preds = %11
%35 = call i32 @write_ZIGBEE_long(i32 512, i32 162)
br label %46
36: ; preds = %11
%37 = call i32 @write_ZIGBEE_long(i32 512, i32 178)
br label %46
38: ; preds = %11
%39 = call i32 @write_ZIGBEE_long(i32 512, i32 194)
br label %46
40: ; preds = %11
%41 = call i32 @write_ZIGBEE_long(i32 512, i32 210)
br label %46
42: ; preds = %11
%43 = call i32 @write_ZIGBEE_long(i32 512, i32 226)
br label %46
44: ; preds = %11
%45 = call i32 @write_ZIGBEE_long(i32 512, i32 242)
br label %46
46: ; preds = %11, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14
%47 = call i32 (...) @RF_reset()
ret void
}

LLVM IR (-O2):
define void @set_channel(i16 signext %0) {
%2 = add i16 %0, -27
%3 = icmp ult i16 %2, -16
%4 = add i16 %0, -11
%5 = select i1 %3, i16 0, i16 %4
%6 = icmp ult i16 %5, 16
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = zext i16 %5 to i32
%9 = shl nuw nsw i32 %8, 4
%10 = or i32 %9, 2
%11 = tail call i32 @write_ZIGBEE_long(i32 512, i32 %10)
br label %12
12: ; preds = %1, %7
%13 = tail call i32 (...) @RF_reset()
ret void
}