const char *digest_md5_qops2qopstr(int qops) {
  const char *qopstr[] = {"qop-auth",          "qop-auth",
                          "qop-int",           "qop-auth, qop-int",
                          "qop-conf",          "qop-auth, qop-conf",
                          "qop-int, qop-conf", "qop-auth, qop-int, qop-conf"};
  return qopstr[qops & 0x07];
}


x86 assembly (clang, -O0):
<digest_md5_qops2qopstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2cba(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cltq
mov    -0x50(%rbp,%rax,8),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digest_md5_qops2qopstr>:
and    $0x7,%edi
lea    0xf42(%rip),%rcx
movslq (%rcx,%rdi,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"qop-auth\00"
@.str.1 = [8 x i8] c"qop-int\00"
@.str.2 = [18 x i8] c"qop-auth, qop-int\00"
@.str.3 = [9 x i8] c"qop-conf\00"
@.str.4 = [19 x i8] c"qop-auth, qop-conf\00"
@.str.5 = [18 x i8] c"qop-int, qop-conf\00"
@.str.6 = [28 x i8] c"qop-auth, qop-int, qop-conf\00"
@__const.digest_md5_qops2qopstr.qopstr = [8 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i32 0, i32 0)]
define i8* @digest_md5_qops2qopstr(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i8*]
store i32 %0, i32* %2
%4 = bitcast [8 x i8*]* %3 to i8*
%5 = load i32, i32* %2
%6 = and i32 %5, 7
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [8 x i8*], [8 x i8*]* %3, i64 0, i64 %7
%9 = load i8*, i8** %8
ret i8* %9
}

LLVM IR (-O2):
@.str = [9 x i8] c"qop-auth\00"
@.str.1 = [8 x i8] c"qop-int\00"
@.str.2 = [18 x i8] c"qop-auth, qop-int\00"
@.str.3 = [9 x i8] c"qop-conf\00"
@.str.4 = [19 x i8] c"qop-auth, qop-conf\00"
@.str.5 = [18 x i8] c"qop-int, qop-conf\00"
@.str.6 = [28 x i8] c"qop-auth, qop-int, qop-conf\00"
@reltable.digest_md5_qops2qopstr = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.digest_md5_qops2qopstr to i64)) to i32)]
define i8* @digest_md5_qops2qopstr(i32 %0) {
%2 = and i32 %0, 7
%3 = zext i32 %2 to i64
%4 = shl i64 %3, 2
%5 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.digest_md5_qops2qopstr to i8*), i64 %4)
ret i8* %5
}