const char *daErrToString(int err) {
  if (err == 0x00000000) {
    return "DA_OK";
  } else if (err & 0x10000000) {
    if (err & 0x00000001) {
      return "DA_PARAM_ERR | DA_PARAM_NULL";
    } else if (err & 0x00000002) {
      return "DA_PARAM_ERR | DA_UNKNOWN_MODE";
    } else if (err & 0x00000004) {
      return "DA_PARAM_ERR | DA_OUT_OF_BOUNDS";
    } else if (err & 0x00000008) {
      return "DA_PARAM_ERR | DA_EXCEEDS_SIZE_LIMIT";
    }
  } else if (err & 0x20000000) {
    if (err & 0x00000001) {
      return "DA_FATAL | DA_ENOMEM";
    }
  } else if (err == 0x40000000) {
    return "DA_NOT_FOUND";
  }
  return "UNKNOWN ERROR";
}


x86 assembly (clang, -O0):
<daErrToString>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1121 <daErrToString+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
mov    -0xc(%rbp),%eax
and    $0x10000000,%eax
cmp    $0x0,%eax
je     11c2 <daErrToString+0xc2>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1151 <daErrToString+0x51>
lea    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1170 <daErrToString+0x70>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     118f <daErrToString+0x8f>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11ae <daErrToString+0xae>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
jmp    11b3 <daErrToString+0xb3>
jmp    11b8 <daErrToString+0xb8>
jmp    11bd <daErrToString+0xbd>
jmp    121e <daErrToString+0x11e>
mov    -0xc(%rbp),%eax
and    $0x20000000,%eax
cmp    $0x0,%eax
je     11f7 <daErrToString+0xf7>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f2 <daErrToString+0xf2>
lea    0xe9e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
jmp    1219 <daErrToString+0x119>
cmpl   $0x40000000,-0xc(%rbp)
jne    1214 <daErrToString+0x114>
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <daErrToString+0x12e>
jmp    1219 <daErrToString+0x119>
jmp    121e <daErrToString+0x11e>
jmp    1223 <daErrToString+0x123>
lea    0xe7f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<daErrToString>:
test   %edi,%edi
je     1124 <daErrToString+0x24>
test   $0x10000000,%edi
jne    112c <daErrToString+0x2c>
test   $0x20000000,%edi
jne    114c <daErrToString+0x4c>
cmp    $0x40000000,%edi
jne    1152 <daErrToString+0x52>
lea    0xf79(%rip),%rax
ret
lea    0xed5(%rip),%rax
ret
test   $0x1,%dil
jne    115a <daErrToString+0x5a>
test   $0x2,%dil
jne    1162 <daErrToString+0x62>
test   $0x4,%dil
jne    1172 <daErrToString+0x72>
test   $0x8,%dil
je     1152 <daErrToString+0x52>
lea    0xf17(%rip),%rax
ret
test   $0x1,%dil
jne    116a <daErrToString+0x6a>
lea    0xf50(%rip),%rax
ret
lea    0xea5(%rip),%rax
ret
lea    0xeba(%rip),%rax
ret
lea    0xf16(%rip),%rax
ret
lea    0xec9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"DA_OK\00"
@.str.1 = [29 x i8] c"DA_PARAM_ERR | DA_PARAM_NULL\00"
@.str.2 = [31 x i8] c"DA_PARAM_ERR | DA_UNKNOWN_MODE\00"
@.str.3 = [32 x i8] c"DA_PARAM_ERR | DA_OUT_OF_BOUNDS\00"
@.str.4 = [37 x i8] c"DA_PARAM_ERR | DA_EXCEEDS_SIZE_LIMIT\00"
@.str.5 = [21 x i8] c"DA_FATAL | DA_ENOMEM\00"
@.str.6 = [13 x i8] c"DA_NOT_FOUND\00"
@.str.7 = [14 x i8] c"UNKNOWN ERROR\00"
define i8* @daErrToString(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %53
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, 268435456
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %35
11: ; preds = %7
%12 = load i32, i32* %3
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %53
16: ; preds = %11
%17 = load i32, i32* %3
%18 = and i32 %17, 2
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %53
21: ; preds = %16
%22 = load i32, i32* %3
%23 = and i32 %22, 4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %53
26: ; preds = %21
%27 = load i32, i32* %3
%28 = and i32 %27, 8
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %53
31: ; preds = %26
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
br label %51
35: ; preds = %7
%36 = load i32, i32* %3
%37 = and i32 %36, 536870912
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = load i32, i32* %3
%41 = and i32 %40, 1
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %39
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %53
44: ; preds = %39
br label %50
45: ; preds = %35
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 1073741824
br i1 %47, label %48, label %49
48: ; preds = %45
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %53
49: ; preds = %45
br label %50
50: ; preds = %49, %44
br label %51
51: ; preds = %50, %34
br label %52
52: ; preds = %51
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %53
53: ; preds = %52, %48, %43, %30, %25, %20, %15, %6
%54 = load i8*, i8** %2
ret i8* %54
}

LLVM IR (-O2):
@.str = [6 x i8] c"DA_OK\00"
@.str.1 = [29 x i8] c"DA_PARAM_ERR | DA_PARAM_NULL\00"
@.str.2 = [31 x i8] c"DA_PARAM_ERR | DA_UNKNOWN_MODE\00"
@.str.3 = [32 x i8] c"DA_PARAM_ERR | DA_OUT_OF_BOUNDS\00"
@.str.4 = [37 x i8] c"DA_PARAM_ERR | DA_EXCEEDS_SIZE_LIMIT\00"
@.str.5 = [21 x i8] c"DA_FATAL | DA_ENOMEM\00"
@.str.6 = [13 x i8] c"DA_NOT_FOUND\00"
@.str.7 = [14 x i8] c"UNKNOWN ERROR\00"
define i8* @daErrToString(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %27, label %3
3: ; preds = %1
%4 = and i32 %0, 268435456
%5 = icmp eq i32 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %3
%7 = and i32 %0, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = and i32 %0, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = and i32 %0, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = and i32 %0, 8
%17 = icmp eq i32 %16, 0
br i1 %17, label %26, label %27
18: ; preds = %3
%19 = and i32 %0, 536870912
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = and i32 %0, 1
%23 = icmp eq i32 %22, 0
br i1 %23, label %26, label %27
24: ; preds = %18
%25 = icmp eq i32 %0, 1073741824
br i1 %25, label %27, label %26
26: ; preds = %15, %24, %21
br label %27
27: ; preds = %24, %21, %15, %12, %9, %6, %1, %26
%28 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %26 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %12 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), %15 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), %21 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), %24 ]
ret i8* %28
}