float convert(char from_conv, char to_conv, float input_val) {
  float conv_val = 0.0f;
  switch (from_conv) {
  case 'b':
    switch (to_conv) {
    case 'l':
      conv_val = input_val / 3.0f;
      break;
    default:
      return -1.0f;
    }
    break;
  case 'l':
    switch (to_conv) {
    case 'b':
      conv_val = input_val * 3.0f;
      break;
    default:
      return -1.0f;
    }
    break;
  default:
    return -1.0f;
  }
  return conv_val;
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x62,%eax
je     1142 <convert+0x42>
jmp    1131 <convert+0x31>
mov    -0x14(%rbp),%eax
sub    $0x6c,%eax
je     1184 <convert+0x84>
jmp    11c2 <convert+0xc2>
mov    -0x6(%rbp),%al
sub    $0x6c,%al
jne    116d <convert+0x6d>
jmp    1152 <convert+0x52>
movss  -0xc(%rbp),%xmm0
movss  0xea1(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    117f <convert+0x7f>
movss  0xe8f(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11de <convert+0xde>
jmp    11d4 <convert+0xd4>
mov    -0x6(%rbp),%al
sub    $0x62,%al
jne    11ab <convert+0xab>
jmp    1194 <convert+0x94>
movss  0xe64(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11bd <convert+0xbd>
movss  0xe51(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11de <convert+0xde>
jmp    11d4 <convert+0xd4>
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11de <convert+0xde>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
cmp    $0x6c,%edi
je     1121 <convert+0x21>
movss  0xef3(%rip),%xmm1
cmp    $0x62,%edi
jne    112f <convert+0x2f>
cmp    $0x6c,%sil
jne    112f <convert+0x2f>
divss  0xee4(%rip),%xmm0
ret
cmp    $0x62,%sil
je     1133 <convert+0x33>
movss  0xed1(%rip),%xmm1
movaps %xmm1,%xmm0
ret
mulss  0xec9(%rip),%xmm0
ret

LLVM IR (-O0):
define float @convert(i8 signext %0, i8 signext %1, float %2) {
%4 = alloca float
%5 = alloca i8
%6 = alloca i8
%7 = alloca float
%8 = alloca float
store i8 %0, i8* %5
store i8 %1, i8* %6
store float %2, float* %7
store float 0.000000e+00, float* %8
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
switch i32 %10, label %27 [
i32 98, label %11
i32 108, label %19
]
11: ; preds = %3
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
switch i32 %13, label %17 [
i32 108, label %14
]
14: ; preds = %11
%15 = load float, float* %7
%16 = fdiv float %15, 3.000000e+00
store float %16, float* %8
br label %18
17: ; preds = %11
store float -1.000000e+00, float* %4
br label %30
18: ; preds = %14
br label %28
19: ; preds = %3
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
switch i32 %21, label %25 [
i32 98, label %22
]
22: ; preds = %19
%23 = load float, float* %7
%24 = fmul float %23, 3.000000e+00
store float %24, float* %8
br label %26
25: ; preds = %19
store float -1.000000e+00, float* %4
br label %30
26: ; preds = %22
br label %28
27: ; preds = %3
store float -1.000000e+00, float* %4
br label %30
28: ; preds = %26, %18
%29 = load float, float* %8
store float %29, float* %4
br label %30
30: ; preds = %28, %27, %25, %17
%31 = load float, float* %4
ret float %31
}

LLVM IR (-O2):
define float @convert(i8 signext %0, i8 signext %1, float %2) {
%4 = sext i8 %0 to i32
switch i32 %4, label %13 [
i32 98, label %5
i32 108, label %9
]
5: ; preds = %3
%6 = icmp eq i8 %1, 108
br i1 %6, label %7, label %13
7: ; preds = %5
%8 = fdiv float %2, 3.000000e+00
br label %13
9: ; preds = %3
%10 = icmp eq i8 %1, 98
%11 = fmul float %2, 3.000000e+00
%12 = select i1 %10, float %11, float -1.000000e+00
br label %13
13: ; preds = %9, %7, %3, %5
%14 = phi float [ -1.000000e+00, %5 ], [ -1.000000e+00, %3 ], [ %8, %7 ], [ %12, %9 ]
ret float %14
}