int st_Alaw_to_linear(unsigned char Alawbyte) {
  static int exp_lut[8] = {0, 264, 528, 1056, 2112, 4224, 8448, 16896};
  int sign, exponent, mantissa, sample;
  Alawbyte ^= 0x55;
  sign = (Alawbyte & 0x80);
  Alawbyte &= 0x7f;
  if (Alawbyte >= 16) {
    exponent = (Alawbyte >> 4) & 0x07;
    mantissa = Alawbyte & 0x0F;
    sample = exp_lut[exponent] + (mantissa << (exponent + 3));
  } else
    sample = (Alawbyte << 4) + 8;
  if (sign == 0)
    sample = -sample;
  return sample;
}


x86 assembly (clang, -O0):
<st_Alaw_to_linear>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
xor    $0x55,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x10,%eax
jl     1173 <st_Alaw_to_linear+0x73>
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2ed7(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1180 <st_Alaw_to_linear+0x80>
movzbl -0x1(%rbp),%eax
shl    $0x4,%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1192 <st_Alaw_to_linear+0x92>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_Alaw_to_linear>:
mov    %edi,%eax
and    $0x7f,%al
xor    $0x55,%al
movzbl %al,%edx
cmp    $0x10,%dl
jb     1129 <st_Alaw_to_linear+0x29>
mov    %edx,%eax
shr    $0x4,%eax
and    $0xf,%edx
mov    %eax,%ecx
add    $0x3,%cl
shl    %cl,%edx
lea    0xedc(%rip),%rcx
add    (%rcx,%rax,4),%edx
jmp    112f <st_Alaw_to_linear+0x2f>
shl    $0x4,%edx
or     $0x8,%edx
mov    %edx,%eax
neg    %eax
test   %dil,%dil
cmovs  %edx,%eax
ret

LLVM IR (-O0):
@st_Alaw_to_linear.exp_lut = internal global [8 x i32] [i32 0, i32 264, i32 528, i32 1056, i32 2112, i32 4224, i32 8448, i32 16896]
define i32 @st_Alaw_to_linear(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %2
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = xor i32 %8, 85
%10 = trunc i32 %9 to i8
store i8 %10, i8* %2
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = and i32 %12, 128
store i32 %13, i32* %3
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = and i32 %15, 127
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
%18 = load i8, i8* %2
%19 = zext i8 %18 to i32
%20 = icmp sge i32 %19, 16
br i1 %20, label %21, label %38
21: ; preds = %1
%22 = load i8, i8* %2
%23 = zext i8 %22 to i32
%24 = ashr i32 %23, 4
%25 = and i32 %24, 7
store i32 %25, i32* %4
%26 = load i8, i8* %2
%27 = zext i8 %26 to i32
%28 = and i32 %27, 15
store i32 %28, i32* %5
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [8 x i32], [8 x i32]* @st_Alaw_to_linear.exp_lut, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %5
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 3
%36 = shl i32 %33, %35
%37 = add nsw i32 %32, %36
store i32 %37, i32* %6
br label %43
38: ; preds = %1
%39 = load i8, i8* %2
%40 = zext i8 %39 to i32
%41 = shl i32 %40, 4
%42 = add nsw i32 %41, 8
store i32 %42, i32* %6
br label %43
43: ; preds = %38, %21
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %6
%48 = sub nsw i32 0, %47
store i32 %48, i32* %6
br label %49
49: ; preds = %46, %43
%50 = load i32, i32* %6
ret i32 %50
}

LLVM IR (-O2):
@st_Alaw_to_linear.exp_lut = internal unnamed_addr constant [8 x i32] [i32 0, i32 264, i32 528, i32 1056, i32 2112, i32 4224, i32 8448, i32 16896]
define i32 @st_Alaw_to_linear(i8 zeroext %0) {
%2 = and i8 %0, 127
%3 = xor i8 %2, 85
%4 = zext i8 %3 to i32
%5 = icmp ugt i8 %3, 15
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = lshr i32 %4, 4
%8 = and i32 %4, 15
%9 = zext i32 %7 to i64
%10 = getelementptr inbounds [8 x i32], [8 x i32]* @st_Alaw_to_linear.exp_lut, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = add nuw nsw i32 %7, 3
%13 = shl nuw nsw i32 %8, %12
%14 = add nsw i32 %11, %13
br label %18
15: ; preds = %1
%16 = shl nuw nsw i32 %4, 4
%17 = or i32 %16, 8
br label %18
18: ; preds = %15, %6
%19 = phi i32 [ %14, %6 ], [ %17, %15 ]
%20 = icmp sgt i8 %0, -1
%21 = sub nsw i32 0, %19
%22 = select i1 %20, i32 %21, i32 %19
ret i32 %22
}