const char *change_to_string(int change) {
  change &= (0x01 | 0x02);
  if (change == 0x01) {
    return "add";
  } else if (change == 0x02) {
    return "del";
  } else if (change == 0) {
    return "none";
  } else {
    return "???";
  }
}


x86 assembly (clang, -O0):
<change_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    112a <change_to_string+0x2a>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <change_to_string+0x69>
cmpl   $0x2,-0xc(%rbp)
jne    1144 <change_to_string+0x44>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <change_to_string+0x69>
cmpl   $0x0,-0xc(%rbp)
jne    115e <change_to_string+0x5e>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <change_to_string+0x69>
lea    0xea8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_to_string>:
and    $0x3,%edi
cmp    $0x3,%edi
jne    1110 <change_to_string+0x10>
lea    0xefe(%rip),%rax
ret
mov    %edi,%eax
lea    0xefb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"add\00"
@.str.1 = [4 x i8] c"del\00"
@.str.2 = [5 x i8] c"none\00"
@.str.3 = [4 x i8] c"???\00"
define i8* @change_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 3
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %18
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %9
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %18
13: ; preds = %9
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %18
17: ; preds = %13
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %18
18: ; preds = %17, %16, %12, %8
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
@.str.1 = [4 x i8] c"del\00"
@.str.2 = [5 x i8] c"none\00"
@.str.3 = [4 x i8] c"???\00"
@reltable.change_to_string = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.change_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.change_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.change_to_string to i64)) to i32)]
define i8* @change_to_string(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 3
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.change_to_string to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}