int get_armor_ac_mod(int level, int tlevel) {
  if (tlevel >= 20) {
    if (level > 19)
      return 3;
    if (level > 4)
      return 4;
    return 5;
  }
  if (tlevel >= 15) {
    if (level > 19)
      return 1;
    if (level > 4)
      return 2;
    return 3;
  }
  if (tlevel > 5) {
    if (level > 19)
      return -5;
    if (level > 4)
      return -3;
    return -1;
  }
  if (level > 19)
    return -10;
  if (level > 4)
    return -4;
  return -1;
}


x86 assembly (clang, -O0):
<get_armor_ac_mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jl     114c <get_armor_ac_mod+0x4c>
cmpl   $0x13,-0x8(%rbp)
jle    112a <get_armor_ac_mod+0x2a>
movl   $0x3,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x4,-0x8(%rbp)
jle    1140 <get_armor_ac_mod+0x40>
movl   $0x4,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
movl   $0x5,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0xf,-0xc(%rbp)
jl     118e <get_armor_ac_mod+0x8e>
cmpl   $0x13,-0x8(%rbp)
jle    116c <get_armor_ac_mod+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x4,-0x8(%rbp)
jle    1182 <get_armor_ac_mod+0x82>
movl   $0x2,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
movl   $0x3,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x5,-0xc(%rbp)
jle    11d0 <get_armor_ac_mod+0xd0>
cmpl   $0x13,-0x8(%rbp)
jle    11ae <get_armor_ac_mod+0xae>
movl   $0xfffffffb,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x4,-0x8(%rbp)
jle    11c4 <get_armor_ac_mod+0xc4>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
movl   $0xffffffff,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x13,-0x8(%rbp)
jle    11e6 <get_armor_ac_mod+0xe6>
movl   $0xfffffff6,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
cmpl   $0x4,-0x8(%rbp)
jle    11fc <get_armor_ac_mod+0xfc>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1203 <get_armor_ac_mod+0x103>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_armor_ac_mod>:
cmp    $0x14,%esi
jl     111b <get_armor_ac_mod+0x1b>
mov    $0x3,%eax
cmp    $0x13,%edi
jg     116a <get_armor_ac_mod+0x6a>
xor    %eax,%eax
cmp    $0x5,%edi
setge  %al
xor    $0x5,%eax
ret
cmp    $0xf,%esi
jl     1136 <get_armor_ac_mod+0x36>
mov    $0x1,%eax
cmp    $0x13,%edi
jg     116a <get_armor_ac_mod+0x6a>
xor    %eax,%eax
cmp    $0x5,%edi
setge  %al
xor    $0x3,%eax
ret
cmp    $0x6,%esi
jl     1153 <get_armor_ac_mod+0x53>
mov    $0xfffffffb,%eax
cmp    $0x13,%edi
jg     116a <get_armor_ac_mod+0x6a>
xor    %eax,%eax
cmp    $0x5,%edi
setl   %al
add    %eax,%eax
or     $0xfffffffd,%eax
ret
mov    $0xfffffff6,%eax
cmp    $0x13,%edi
jg     116a <get_armor_ac_mod+0x6a>
xor    %eax,%eax
cmp    $0x5,%edi
setl   %al
neg    %eax
or     $0xfffffffc,%eax
ret

LLVM IR (-O0):
define i32 @get_armor_ac_mod(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sge i32 %6, 20
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 19
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 3, i32* %3
br label %50
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 4
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 4, i32* %3
br label %50
16: ; preds = %12
store i32 5, i32* %3
br label %50
17: ; preds = %2
%18 = load i32, i32* %5
%19 = icmp sge i32 %18, 15
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 19
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 1, i32* %3
br label %50
24: ; preds = %20
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 4
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 2, i32* %3
br label %50
28: ; preds = %24
store i32 3, i32* %3
br label %50
29: ; preds = %17
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 5
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 19
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 -5, i32* %3
br label %50
36: ; preds = %32
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 4
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 -3, i32* %3
br label %50
40: ; preds = %36
store i32 -1, i32* %3
br label %50
41: ; preds = %29
%42 = load i32, i32* %4
%43 = icmp sgt i32 %42, 19
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 -10, i32* %3
br label %50
45: ; preds = %41
%46 = load i32, i32* %4
%47 = icmp sgt i32 %46, 4
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 -4, i32* %3
br label %50
49: ; preds = %45
store i32 -1, i32* %3
br label %50
50: ; preds = %49, %48, %44, %40, %39, %35, %28, %27, %23, %16, %15, %11
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
define i32 @get_armor_ac_mod(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 19
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = icmp sgt i32 %0, 19
br i1 %5, label %27, label %6
6: ; preds = %4
%7 = icmp sgt i32 %0, 4
%8 = select i1 %7, i32 4, i32 5
br label %27
9: ; preds = %2
%10 = icmp sgt i32 %1, 14
br i1 %10, label %11, label %16
11: ; preds = %9
%12 = icmp sgt i32 %0, 19
br i1 %12, label %27, label %13
13: ; preds = %11
%14 = icmp sgt i32 %0, 4
%15 = select i1 %14, i32 2, i32 3
br label %27
16: ; preds = %9
%17 = icmp sgt i32 %1, 5
%18 = icmp sgt i32 %0, 19
br i1 %17, label %19, label %23
19: ; preds = %16
br i1 %18, label %27, label %20
20: ; preds = %19
%21 = icmp sgt i32 %0, 4
%22 = select i1 %21, i32 -3, i32 -1
br label %27
23: ; preds = %16
br i1 %18, label %27, label %24
24: ; preds = %23
%25 = icmp sgt i32 %0, 4
%26 = select i1 %25, i32 -4, i32 -1
br label %27
27: ; preds = %24, %23, %20, %19, %13, %11, %6, %4
%28 = phi i32 [ 3, %4 ], [ %8, %6 ], [ 1, %11 ], [ %15, %13 ], [ -5, %19 ], [ %22, %20 ], [ -10, %23 ], [ %26, %24 ]
ret i32 %28
}