int alaw_decode(unsigned int 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):
<alaw_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x55,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jb     1168 <alaw_decode+0x68>
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2ee2(%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    1174 <alaw_decode+0x74>
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1186 <alaw_decode+0x86>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alaw_decode>:
mov    %edi,%edx
and    $0x7f,%edx
xor    $0x55,%edx
cmp    $0x10,%edx
jb     1128 <alaw_decode+0x28>
mov    %edx,%eax
shr    $0x4,%eax
and    $0xf,%edx
mov    %eax,%ecx
add    $0x3,%cl
shl    %cl,%edx
lea    0xedd(%rip),%rcx
add    (%rcx,%rax,4),%edx
jmp    112e <alaw_decode+0x2e>
shl    $0x4,%edx
or     $0x8,%edx
mov    %edx,%eax
neg    %eax
test   $0x80,%dil
cmovne %edx,%eax
ret

LLVM IR (-O0):
@alaw_decode.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 @alaw_decode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = xor i32 %7, 85
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = and i32 %9, 128
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = and i32 %11, 127
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp uge i32 %13, 16
br i1 %14, label %15, label %30
15: ; preds = %1
%16 = load i32, i32* %2
%17 = lshr i32 %16, 4
%18 = and i32 %17, 7
store i32 %18, i32* %4
%19 = load i32, i32* %2
%20 = and i32 %19, 15
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i32], [8 x i32]* @alaw_decode.exp_lut, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 3
%28 = shl i32 %25, %27
%29 = add nsw i32 %24, %28
store i32 %29, i32* %6
br label %34
30: ; preds = %1
%31 = load i32, i32* %2
%32 = shl i32 %31, 4
%33 = add i32 %32, 8
store i32 %33, i32* %6
br label %34
34: ; preds = %30, %15
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sub nsw i32 0, %38
store i32 %39, i32* %6
br label %40
40: ; preds = %37, %34
%41 = load i32, i32* %6
ret i32 %41
}

LLVM IR (-O2):
@alaw_decode.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 @alaw_decode(i32 %0) {
%2 = and i32 %0, 127
%3 = xor i32 %2, 85
%4 = icmp ugt i32 %3, 15
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = lshr i32 %3, 4
%7 = and i32 %3, 15
%8 = zext i32 %6 to i64
%9 = getelementptr inbounds [8 x i32], [8 x i32]* @alaw_decode.exp_lut, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = add nuw nsw i32 %6, 3
%12 = shl i32 %7, %11
%13 = add nsw i32 %10, %12
br label %17
14: ; preds = %1
%15 = shl nuw nsw i32 %3, 4
%16 = or i32 %15, 8
br label %17
17: ; preds = %14, %5
%18 = phi i32 [ %13, %5 ], [ %16, %14 ]
%19 = and i32 %0, 128
%20 = icmp eq i32 %19, 0
%21 = sub nsw i32 0, %18
%22 = select i1 %20, i32 %21, i32 %18
ret i32 %22
}