#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*/ Log(int, char *, int);
int calculate_cisco_mos(int icpif) {
  int mos;
  Log(7, "Calculating Cisco MOS with ICPIF: %d", icpif);
  if (icpif <= 3) {
    mos = 5;
  } else if (icpif <= 13) {
    mos = 4;
  } else if (icpif <= 23) {
    mos = 3;
  } else if (icpif <= 33) {
    mos = 2;
  } else {
    mos = 1;
  }
  return mos;
}


x86 assembly (clang, -O0):
<calculate_cisco_mos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x7,%edi
lea    0xed6(%rip),%rsi
call   1030 <Log@plt>
cmpl   $0x3,-0x4(%rbp)
jg     1145 <calculate_cisco_mos+0x35>
movl   $0x5,-0x8(%rbp)
jmp    119d <calculate_cisco_mos+0x8d>
cmpl   $0xd,-0x4(%rbp)
jg     115b <calculate_cisco_mos+0x4b>
movl   $0x4,-0x8(%rbp)
jmp    1198 <calculate_cisco_mos+0x88>
cmpl   $0x17,-0x4(%rbp)
jg     1171 <calculate_cisco_mos+0x61>
movl   $0x3,-0x8(%rbp)
jmp    1193 <calculate_cisco_mos+0x83>
cmpl   $0x21,-0x4(%rbp)
jg     1187 <calculate_cisco_mos+0x77>
movl   $0x2,-0x8(%rbp)
jmp    118e <calculate_cisco_mos+0x7e>
movl   $0x1,-0x8(%rbp)
jmp    1193 <calculate_cisco_mos+0x83>
jmp    1198 <calculate_cisco_mos+0x88>
jmp    119d <calculate_cisco_mos+0x8d>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_cisco_mos>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rsi
mov    $0x7,%edi
mov    %ebx,%edx
call   1030 <Log@plt>
mov    $0x5,%eax
cmp    $0x4,%ebx
jl     114f <calculate_cisco_mos+0x3f>
mov    $0x4,%eax
cmp    $0xe,%ebx
jb     114f <calculate_cisco_mos+0x3f>
mov    $0x3,%eax
cmp    $0x18,%ebx
jb     114f <calculate_cisco_mos+0x3f>
cmp    $0x22,%ebx
mov    $0x1,%eax
adc    $0x0,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Calculating Cisco MOS with ICPIF: %d\00"
define i32 @calculate_cisco_mos(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @Log(i32 7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 3
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 5, i32* %3
br label %25
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 13
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 4, i32* %3
br label %24
13: ; preds = %9
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 23
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 3, i32* %3
br label %23
17: ; preds = %13
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 33
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 2, i32* %3
br label %22
21: ; preds = %17
store i32 1, i32* %3
br label %22
22: ; preds = %21, %20
br label %23
23: ; preds = %22, %16
br label %24
24: ; preds = %23, %12
br label %25
25: ; preds = %24, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [37 x i8] c"Calculating Cisco MOS with ICPIF: %d\00"
define i32 @calculate_cisco_mos(i32 %0) {
%2 = tail call i32 @Log(i32 7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp slt i32 %0, 4
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = icmp ult i32 %0, 14
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = icmp ult i32 %0, 24
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = icmp ult i32 %0, 34
%10 = select i1 %9, i32 2, i32 1
br label %11
11: ; preds = %8, %6, %4, %1
%12 = phi i32 [ 5, %1 ], [ 4, %4 ], [ 3, %6 ], [ %10, %8 ]
ret i32 %12
}