#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 */
typedef int int32_t;

/* Variables and functions */
int get_channel_from_frequency(int32_t frequency) {
  if (frequency >= 2412 && frequency <= 2472)
    return (frequency - 2407) / 5;
  if (frequency == 2484)
    return 14;
  if (frequency >= 5000 && frequency <= 6100)
    return (frequency - 5000) / 5;
  return -1;
}


x86 assembly (clang, -O0):
<get_channel_from_frequency>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x96c,-0x8(%rbp)
jl     1139 <get_channel_from_frequency+0x39>
cmpl   $0x9a8,-0x8(%rbp)
jg     1139 <get_channel_from_frequency+0x39>
mov    -0x8(%rbp),%eax
sub    $0x967,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    118b <get_channel_from_frequency+0x8b>
cmpl   $0x9b4,-0x8(%rbp)
jne    1152 <get_channel_from_frequency+0x52>
movl   $0xe,-0x4(%rbp)
jmp    118b <get_channel_from_frequency+0x8b>
cmpl   $0x1388,-0x8(%rbp)
jl     1184 <get_channel_from_frequency+0x84>
cmpl   $0x17d4,-0x8(%rbp)
jg     1184 <get_channel_from_frequency+0x84>
mov    -0x8(%rbp),%eax
sub    $0x1388,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    118b <get_channel_from_frequency+0x8b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_channel_from_frequency>:
lea    -0x96c(%rdi),%eax
cmp    $0x3c,%eax
ja     111d <get_channel_from_frequency+0x1d>
add    $0x99,%dil
movzbl %dil,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
ret
mov    $0xe,%eax
cmp    $0x9b4,%edi
je     1149 <get_channel_from_frequency+0x49>
add    $0xffffec78,%edi
mov    $0xffffffff,%eax
cmp    $0x44c,%edi
ja     1149 <get_channel_from_frequency+0x49>
movzwl %di,%eax
imul   $0xcccd,%eax,%eax
shr    $0x12,%eax
ret

LLVM IR (-O0):
define i32 @get_channel_from_frequency(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 2412
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 2472
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 2407
%12 = sdiv i32 %11, 5
store i32 %12, i32* %2
br label %28
13: ; preds = %6, %1
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 2484
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 14, i32* %2
br label %28
17: ; preds = %13
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 5000
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 6100
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 5000
%26 = sdiv i32 %25, 5
store i32 %26, i32* %2
br label %28
27: ; preds = %20, %17
store i32 -1, i32* %2
br label %28
28: ; preds = %27, %23, %16, %9
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @get_channel_from_frequency(i32 %0) {
%2 = add i32 %0, -2412
%3 = icmp ult i32 %2, 61
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = trunc i32 %0 to i8
%6 = add i8 %5, -103
%7 = udiv i8 %6, 5
%8 = zext i8 %7 to i32
br label %18
9: ; preds = %1
%10 = icmp eq i32 %0, 2484
br i1 %10, label %18, label %11
11: ; preds = %9
%12 = add i32 %0, -5000
%13 = icmp ult i32 %12, 1101
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = trunc i32 %12 to i16
%16 = udiv i16 %15, 5
%17 = zext i16 %16 to i32
br label %18
18: ; preds = %11, %9, %14, %4
%19 = phi i32 [ %8, %4 ], [ %17, %14 ], [ 14, %9 ], [ -1, %11 ]
ret i32 %19
}