const char *respcode2str(int respcode) {
  if (respcode >= 100 && respcode < 199) {
    return "status info";
  }
  if (respcode >= 200 && respcode < 299) {
    return "OK";
  }
  if (respcode >= 300 && respcode < 399) {
    return "URI redirect";
  }
  if (respcode >= 400 && respcode < 499) {
    return "client error";
  }
  return "Server Error";
}


x86 assembly (clang, -O0):
<respcode2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jl     112e <respcode2str+0x2e>
cmpl   $0xc7,-0xc(%rbp)
jge    112e <respcode2str+0x2e>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <respcode2str+0xb7>
cmpl   $0xc8,-0xc(%rbp)
jl     1158 <respcode2str+0x58>
cmpl   $0x12b,-0xc(%rbp)
jge    1158 <respcode2str+0x58>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <respcode2str+0xb7>
cmpl   $0x12c,-0xc(%rbp)
jl     1182 <respcode2str+0x82>
cmpl   $0x18f,-0xc(%rbp)
jge    1182 <respcode2str+0x82>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <respcode2str+0xb7>
cmpl   $0x190,-0xc(%rbp)
jl     11ac <respcode2str+0xac>
cmpl   $0x1f3,-0xc(%rbp)
jge    11ac <respcode2str+0xac>
lea    0xe79(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <respcode2str+0xb7>
lea    0xe76(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<respcode2str>:
lea    -0x64(%rdi),%eax
cmp    $0x63,%eax
jae    1110 <respcode2str+0x10>
lea    0xef1(%rip),%rax
ret
lea    -0xc8(%rdi),%eax
cmp    $0x63,%eax
jae    1123 <respcode2str+0x23>
lea    0xeea(%rip),%rax
ret
lea    -0x12c(%rdi),%eax
cmp    $0x63,%eax
jae    1136 <respcode2str+0x36>
lea    0xeda(%rip),%rax
ret
add    $0xfffffe70,%edi
cmp    $0x63,%edi
lea    0xed6(%rip),%rcx
lea    0xedc(%rip),%rax
cmovb  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"status info\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [13 x i8] c"URI redirect\00"
@.str.3 = [13 x i8] c"client error\00"
@.str.4 = [13 x i8] c"Server Error\00"
define i8* @respcode2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 100
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 199
br i1 %8, label %9, label %10
9: ; preds = %6
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %32
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 200
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 299
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %32
17: ; preds = %13, %10
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 300
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 399
br i1 %22, label %23, label %24
23: ; preds = %20
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %32
24: ; preds = %20, %17
%25 = load i32, i32* %3
%26 = icmp sge i32 %25, 400
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 499
br i1 %29, label %30, label %31
30: ; preds = %27
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %32
31: ; preds = %27, %24
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %32
32: ; preds = %31, %30, %23, %16, %9
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@.str = [12 x i8] c"status info\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [13 x i8] c"URI redirect\00"
@.str.3 = [13 x i8] c"client error\00"
@.str.4 = [13 x i8] c"Server Error\00"
define i8* @respcode2str(i32 %0) {
%2 = add i32 %0, -100
%3 = icmp ult i32 %2, 99
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -200
%6 = icmp ult i32 %5, 99
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = add i32 %0, -300
%9 = icmp ult i32 %8, 99
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = add i32 %0, -400
%12 = icmp ult i32 %11, 99
%13 = select i1 %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0)
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %7 ], [ %13, %10 ]
ret i8* %15
}