char *get_damage_string(unsigned damage) {
  if (damage > 50)
    return "\x1B[38;5;1mannihilates\x1B[0m";
  if (damage > 25)
    return "\x1B[38;5;2mpowerfully hits\x1B[0m";
  if (damage > 10)
    return "\x1B[38;5;3mhits\x1B[0m";
  if (damage > 5)
    return "\x1B[38;5;4mhits lightly\x1B[0m";
  return "\x1B[38;5;5mtickles\x1B[0m";
}


x86 assembly (clang, -O0):
<get_damage_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jbe    1121 <get_damage_string+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <get_damage_string+0x7a>
cmpl   $0x19,-0xc(%rbp)
jbe    113b <get_damage_string+0x3b>
lea    0xee7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <get_damage_string+0x7a>
cmpl   $0xa,-0xc(%rbp)
jbe    1155 <get_damage_string+0x55>
lea    0xeea(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <get_damage_string+0x7a>
cmpl   $0x5,-0xc(%rbp)
jbe    116f <get_damage_string+0x6f>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <get_damage_string+0x7a>
lea    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_damage_string>:
cmp    $0x32,%edi
jbe    110d <get_damage_string+0xd>
lea    0xef4(%rip),%rax
ret
cmp    $0x19,%edi
jbe    111a <get_damage_string+0x1a>
lea    0xf00(%rip),%rax
ret
cmp    $0xa,%edi
jbe    1127 <get_damage_string+0x27>
lea    0xf10(%rip),%rax
ret
cmp    $0x6,%edi
lea    0xf17(%rip),%rcx
lea    0xf2a(%rip),%rax
cmovae %rcx,%rax
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\1B[38;5;1mannihilates\1B[0m\00"
@.str.1 = [29 x i8] c"\1B[38;5;2mpowerfully hits\1B[0m\00"
@.str.2 = [18 x i8] c"\1B[38;5;3mhits\1B[0m\00"
@.str.3 = [26 x i8] c"\1B[38;5;4mhits lightly\1B[0m\00"
@.str.4 = [21 x i8] c"\1B[38;5;5mtickles\1B[0m\00"
define i8* @get_damage_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ugt i32 %4, 50
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp ugt i32 %8, 25
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %20
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp ugt i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp ugt i32 %16, 5
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %15
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %19, %18, %14, %10, %6
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [25 x i8] c"\1B[38;5;1mannihilates\1B[0m\00"
@.str.1 = [29 x i8] c"\1B[38;5;2mpowerfully hits\1B[0m\00"
@.str.2 = [18 x i8] c"\1B[38;5;3mhits\1B[0m\00"
@.str.3 = [26 x i8] c"\1B[38;5;4mhits lightly\1B[0m\00"
@.str.4 = [21 x i8] c"\1B[38;5;5mtickles\1B[0m\00"
define i8* @get_damage_string(i32 %0) {
%2 = icmp ugt i32 %0, 50
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 25
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp ugt i32 %0, 10
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp ugt i32 %0, 5
%9 = select i1 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0)
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %5 ], [ %9, %7 ]
ret i8* %11
}