void fax_init_swaptable(int direct, unsigned char byte_tab[]) {
  int i;
  if (direct)
    for (i = 0; i < 256; i++)
      byte_tab[i] = i;
  else
    for (i = 0; i < 256; i++)
      byte_tab[i] = (((i & 0x01) << 7) | ((i & 0x02) << 5) | ((i & 0x04) << 3) |
                     ((i & 0x08) << 1) | ((i & 0x10) >> 1) | ((i & 0x20) >> 3) |
                     ((i & 0x40) >> 5) | ((i & 0x80) >> 7));
}


x86 assembly (clang, -O0):
<fax_init_swaptable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114c <fax_init_swaptable+0x4c>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    1147 <fax_init_swaptable+0x47>
mov    -0x14(%rbp),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <fax_init_swaptable+0x1c>
jmp    11d9 <fax_init_swaptable+0xd9>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11d4 <fax_init_swaptable+0xd4>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
shl    $0x7,%eax
mov    -0x14(%rbp),%ecx
and    $0x2,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x4,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x8,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x10,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x20,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x40,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x80,%ecx
sar    $0x7,%ecx
or     %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <fax_init_swaptable+0x53>
jmp    11d9 <fax_init_swaptable+0xd9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fax_init_swaptable>:
movdqa 0xef8(%rip),%xmm0
test   %edi,%edi
je     11d2 <fax_init_swaptable+0xd2>
movdqu %xmm0,(%rsi)
movaps 0xef5(%rip),%xmm0
movups %xmm0,0x10(%rsi)
movaps 0xefa(%rip),%xmm0
movups %xmm0,0x20(%rsi)
movaps 0xeff(%rip),%xmm0
movups %xmm0,0x30(%rsi)
movaps 0xf04(%rip),%xmm0
movups %xmm0,0x40(%rsi)
movaps 0xf09(%rip),%xmm0
movups %xmm0,0x50(%rsi)
movaps 0xf0e(%rip),%xmm0
movups %xmm0,0x60(%rsi)
movaps 0xf13(%rip),%xmm0
movups %xmm0,0x70(%rsi)
movaps 0xf18(%rip),%xmm0
movups %xmm0,0x80(%rsi)
movaps 0xf1a(%rip),%xmm0
movups %xmm0,0x90(%rsi)
movaps 0xf1c(%rip),%xmm0
movups %xmm0,0xa0(%rsi)
movaps 0xf1e(%rip),%xmm0
movups %xmm0,0xb0(%rsi)
movaps 0xf20(%rip),%xmm0
movups %xmm0,0xc0(%rsi)
movaps 0xf22(%rip),%xmm0
movups %xmm0,0xd0(%rsi)
movaps 0xf24(%rip),%xmm0
movups %xmm0,0xe0(%rsi)
movaps 0xf26(%rip),%xmm0
movups %xmm0,0xf0(%rsi)
ret
xor    %eax,%eax
movdqa 0xf24(%rip),%xmm1
movdqa 0xf2c(%rip),%xmm2
movdqa 0xf34(%rip),%xmm3
movdqa 0xf3c(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm5
psrlw  $0x4,%xmm5
pand   %xmm1,%xmm5
movdqa %xmm0,%xmm6
pand   %xmm1,%xmm6
psllw  $0x4,%xmm6
por    %xmm5,%xmm6
movdqa %xmm6,%xmm5
psrlw  $0x2,%xmm5
pand   %xmm2,%xmm5
pand   %xmm2,%xmm6
psllw  $0x2,%xmm6
por    %xmm5,%xmm6
movdqa %xmm6,%xmm5
psrlw  $0x1,%xmm5
pand   %xmm3,%xmm5
pand   %xmm3,%xmm6
paddb  %xmm6,%xmm6
por    %xmm5,%xmm6
movdqu %xmm6,(%rsi,%rax,1)
add    $0x10,%rax
paddb  %xmm4,%xmm0
cmp    $0x100,%rax
jne    1200 <fax_init_swaptable+0x100>
ret

LLVM IR (-O0):
define void @fax_init_swaptable(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %2
store i32 0, i32* %5
br label %9
9: ; preds = %19, %8
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 256
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %5
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %14, i8* %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
br label %68
23: ; preds = %2
store i32 0, i32* %5
br label %24
24: ; preds = %64, %23
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 256
br i1 %26, label %27, label %67
27: ; preds = %24
%28 = load i32, i32* %5
%29 = and i32 %28, 1
%30 = shl i32 %29, 7
%31 = load i32, i32* %5
%32 = and i32 %31, 2
%33 = shl i32 %32, 5
%34 = or i32 %30, %33
%35 = load i32, i32* %5
%36 = and i32 %35, 4
%37 = shl i32 %36, 3
%38 = or i32 %34, %37
%39 = load i32, i32* %5
%40 = and i32 %39, 8
%41 = shl i32 %40, 1
%42 = or i32 %38, %41
%43 = load i32, i32* %5
%44 = and i32 %43, 16
%45 = ashr i32 %44, 1
%46 = or i32 %42, %45
%47 = load i32, i32* %5
%48 = and i32 %47, 32
%49 = ashr i32 %48, 3
%50 = or i32 %46, %49
%51 = load i32, i32* %5
%52 = and i32 %51, 64
%53 = ashr i32 %52, 5
%54 = or i32 %50, %53
%55 = load i32, i32* %5
%56 = and i32 %55, 128
%57 = ashr i32 %56, 7
%58 = or i32 %54, %57
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %4
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
store i8 %59, i8* %63
br label %64
64: ; preds = %27
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %24
67: ; preds = %24
br label %68
68: ; preds = %67, %22
ret void
}

LLVM IR (-O2):
define void @fax_init_swaptable(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %36, label %4
4: ; preds = %2
%5 = bitcast i8* %1 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %5
%6 = getelementptr inbounds i8, i8* %1, i64 16
%7 = bitcast i8* %6 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %7
%8 = getelementptr inbounds i8, i8* %1, i64 32
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, <16 x i8>* %9
%10 = getelementptr inbounds i8, i8* %1, i64 48
%11 = bitcast i8* %10 to <16 x i8>*
store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, <16 x i8>* %11
%12 = getelementptr inbounds i8, i8* %1, i64 64
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, <16 x i8>* %13
%14 = getelementptr inbounds i8, i8* %1, i64 80
%15 = bitcast i8* %14 to <16 x i8>*
store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, <16 x i8>* %15
%16 = getelementptr inbounds i8, i8* %1, i64 96
%17 = bitcast i8* %16 to <16 x i8>*
store <16 x i8> <i8 96, i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111>, <16 x i8>* %17
%18 = getelementptr inbounds i8, i8* %1, i64 112
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> <i8 112, i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120, i8 121, i8 122, i8 123, i8 124, i8 125, i8 126, i8 127>, <16 x i8>* %19
%20 = getelementptr inbounds i8, i8* %1, i64 128
%21 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> <i8 -128, i8 -127, i8 -126, i8 -125, i8 -124, i8 -123, i8 -122, i8 -121, i8 -120, i8 -119, i8 -118, i8 -117, i8 -116, i8 -115, i8 -114, i8 -113>, <16 x i8>* %21
%22 = getelementptr inbounds i8, i8* %1, i64 144
%23 = bitcast i8* %22 to <16 x i8>*
store <16 x i8> <i8 -112, i8 -111, i8 -110, i8 -109, i8 -108, i8 -107, i8 -106, i8 -105, i8 -104, i8 -103, i8 -102, i8 -101, i8 -100, i8 -99, i8 -98, i8 -97>, <16 x i8>* %23
%24 = getelementptr inbounds i8, i8* %1, i64 160
%25 = bitcast i8* %24 to <16 x i8>*
store <16 x i8> <i8 -96, i8 -95, i8 -94, i8 -93, i8 -92, i8 -91, i8 -90, i8 -89, i8 -88, i8 -87, i8 -86, i8 -85, i8 -84, i8 -83, i8 -82, i8 -81>, <16 x i8>* %25
%26 = getelementptr inbounds i8, i8* %1, i64 176
%27 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> <i8 -80, i8 -79, i8 -78, i8 -77, i8 -76, i8 -75, i8 -74, i8 -73, i8 -72, i8 -71, i8 -70, i8 -69, i8 -68, i8 -67, i8 -66, i8 -65>, <16 x i8>* %27
%28 = getelementptr inbounds i8, i8* %1, i64 192
%29 = bitcast i8* %28 to <16 x i8>*
store <16 x i8> <i8 -64, i8 -63, i8 -62, i8 -61, i8 -60, i8 -59, i8 -58, i8 -57, i8 -56, i8 -55, i8 -54, i8 -53, i8 -52, i8 -51, i8 -50, i8 -49>, <16 x i8>* %29
%30 = getelementptr inbounds i8, i8* %1, i64 208
%31 = bitcast i8* %30 to <16 x i8>*
store <16 x i8> <i8 -48, i8 -47, i8 -46, i8 -45, i8 -44, i8 -43, i8 -42, i8 -41, i8 -40, i8 -39, i8 -38, i8 -37, i8 -36, i8 -35, i8 -34, i8 -33>, <16 x i8>* %31
%32 = getelementptr inbounds i8, i8* %1, i64 224
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> <i8 -32, i8 -31, i8 -30, i8 -29, i8 -28, i8 -27, i8 -26, i8 -25, i8 -24, i8 -23, i8 -22, i8 -21, i8 -20, i8 -19, i8 -18, i8 -17>, <16 x i8>* %33
%34 = getelementptr inbounds i8, i8* %1, i64 240
%35 = bitcast i8* %34 to <16 x i8>*
store <16 x i8> <i8 -16, i8 -15, i8 -14, i8 -13, i8 -12, i8 -11, i8 -10, i8 -9, i8 -8, i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1>, <16 x i8>* %35
br label %45
36: ; preds = %2, %36
%37 = phi i64 [ %42, %36 ], [ 0, %2 ]
%38 = phi <16 x i8> [ %43, %36 ], [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %2 ]
%39 = call <16 x i8> @llvm.bitreverse.v16i8(<16 x i8> %38)
%40 = getelementptr inbounds i8, i8* %1, i64 %37
%41 = bitcast i8* %40 to <16 x i8>*
store <16 x i8> %39, <16 x i8>* %41
%42 = add nuw i64 %37, 16
%43 = add <16 x i8> %38, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%44 = icmp eq i64 %42, 256
br i1 %44, label %45, label %36
45: ; preds = %36, %4
ret void
}