int ulaw2linear(ulawbyte)
unsigned char ulawbyte;
{
  static int exp_lut[8] = {0, 132, 396, 924, 1980, 4092, 8316, 16764};
  int sign, exponent, mantissa, sample;
  ulawbyte = ~ulawbyte;
  sign = (ulawbyte & 0x80);
  exponent = (ulawbyte >> 4) & 0x07;
  mantissa = ulawbyte & 0x0F;
  sample = exp_lut[exponent] + (mantissa << (exponent + 3));
  if (sign != 0)
    sample = -sample;
  return (sample);
}


x86 assembly (clang, -O0):
<ulaw2linear>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
mov    %eax,-0x8(%rbp)
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    0x2eee(%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)
cmpl   $0x0,-0x8(%rbp)
je     1169 <ulaw2linear+0x69>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulaw2linear>:
not    %edi
mov    %edi,%eax
shr    $0x4,%eax
and    $0x7,%eax
mov    %edi,%edx
and    $0xf,%edx
mov    %eax,%ecx
add    $0x3,%cl
shl    %cl,%edx
lea    0xee3(%rip),%rcx
add    (%rcx,%rax,4),%edx
mov    %edx,%eax
neg    %eax
test   $0x80,%dil
cmove  %edx,%eax
ret

LLVM IR (-O0):
@ulaw2linear.exp_lut = internal global [8 x i32] [i32 0, i32 132, i32 396, i32 924, i32 1980, i32 4092, i32 8316, i32 16764]
define i32 @ulaw2linear(i32 %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = trunc i32 %0 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = xor i32 %9, -1
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 128
store i32 %14, i32* %3
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = ashr i32 %16, 4
%18 = and i32 %17, 7
store i32 %18, i32* %4
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = and i32 %20, 15
store i32 %21, i32* %5
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [8 x i32], [8 x i32]* @ulaw2linear.exp_lut, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 3
%29 = shl i32 %26, %28
%30 = add nsw i32 %25, %29
store i32 %30, i32* %6
%31 = load i32, i32* %3
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %1
%34 = load i32, i32* %6
%35 = sub nsw i32 0, %34
store i32 %35, i32* %6
br label %36
36: ; preds = %33, %1
%37 = load i32, i32* %6
ret i32 %37
}

LLVM IR (-O2):
@ulaw2linear.exp_lut = internal unnamed_addr constant [8 x i32] [i32 0, i32 132, i32 396, i32 924, i32 1980, i32 4092, i32 8316, i32 16764]
define i32 @ulaw2linear(i32 %0) {
%2 = and i32 %0, 255
%3 = xor i32 %2, 255
%4 = and i32 %3, 128
%5 = lshr i32 %3, 4
%6 = and i32 %5, 7
%7 = and i32 %3, 15
%8 = zext i32 %6 to i64
%9 = getelementptr inbounds [8 x i32], [8 x i32]* @ulaw2linear.exp_lut, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = add nuw nsw i32 %6, 3
%12 = shl nuw nsw i32 %7, %11
%13 = add nsw i32 %10, %12
%14 = icmp eq i32 %4, 0
%15 = sub nsw i32 0, %13
%16 = select i1 %14, i32 %13, i32 %15
ret i32 %16
}