#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
unsigned int spdif_swab_s32(unsigned int);
int bs_conv_8_14le(const unsigned char *in_buf, int size,
                   unsigned char *out_buf) {
  static const int inc[7] = {0, 2, 4, 4, 6, 6, 8};
  int n = size / 7;
  int r = size % 7;
  const unsigned char *src = in_buf + n * 7;
  unsigned char *dst = out_buf + n * 8;
  unsigned int i, w1, w2;
  size = n * 8 + inc[r];
  if (r) {
    i = 0;
    for (; i < r; i++)
      dst[i] = src[i];
    for (; i < 7; i++)
      dst[i] = 0;
    w1 = spdif_swab_s32(*(unsigned int *)(dst + 0));
    w2 = spdif_swab_s32(*(unsigned int *)(dst + 3));
    w1 = ((w1 >> 2) & 0x3fff0000) | ((w1 >> 4) & 0x00003fff);
    w2 = ((w2 << 2) & 0x3fff0000) | (w2 & 0x00003fff);
    w1 = ((w1 & 0xff00ff00) >> 8) | ((w1 & 0x00ff00ff) << 8);
    w2 = ((w2 & 0xff00ff00) >> 8) | ((w2 & 0x00ff00ff) << 8);
    (*(unsigned int *)(dst + 0)) = spdif_swab_s32(w1);
    (*(unsigned int *)(dst + 4)) = spdif_swab_s32(w2);
  }
  src -= 7;
  dst -= 8;
  while (n--) {
    w1 = spdif_swab_s32(*(unsigned int *)(src + 0));
    w2 = spdif_swab_s32(*(unsigned int *)(src + 3));
    w1 = ((w1 >> 2) & 0x3fff0000) | ((w1 >> 4) & 0x00003fff);
    w2 = ((w2 << 2) & 0x3fff0000) | (w2 & 0x00003fff);
    w1 = ((w1 & 0xff00ff00) >> 8) | ((w1 & 0x00ff00ff) << 8);
    w2 = ((w2 & 0xff00ff00) >> 8) | ((w2 & 0x00ff00ff) << 8);
    (*(unsigned int *)(dst + 0)) = spdif_swab_s32(w1);
    (*(unsigned int *)(dst + 4)) = spdif_swab_s32(w2);
    src -= 7;
    dst -= 8;
  }
  return size;
}


x86 assembly (clang, -O0):
<bs_conv_8_14le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x7,-0x1c(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x3,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x3,%eax
movslq -0x20(%rbp),%rdx
lea    0xe8a(%rip),%rcx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     128e <bs_conv_8_14le+0x17e>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    11bb <bs_conv_8_14le+0xab>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118d <bs_conv_8_14le+0x7d>
jmp    11c0 <bs_conv_8_14le+0xb0>
cmpl   $0x7,-0x34(%rbp)
jae    11e3 <bs_conv_8_14le+0xd3>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c0 <bs_conv_8_14le+0xb0>
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    0x3(%rax),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
shr    $0x2,%eax
and    $0x3fff0000,%eax
mov    -0x38(%rbp),%ecx
shr    $0x4,%ecx
and    $0x3fff,%ecx
or     %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
shl    $0x2,%eax
and    $0x3fff0000,%eax
mov    -0x3c(%rbp),%ecx
and    $0x3fff,%ecx
or     %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
and    $0xff00ff00,%eax
shr    $0x8,%eax
mov    -0x38(%rbp),%ecx
and    $0xff00ff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
and    $0xff00ff00,%eax
shr    $0x8,%eax
mov    -0x3c(%rbp),%ecx
and    $0xff00ff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff9,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1382 <bs_conv_8_14le+0x272>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    0x3(%rax),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
shr    $0x2,%eax
and    $0x3fff0000,%eax
mov    -0x38(%rbp),%ecx
shr    $0x4,%ecx
and    $0x3fff,%ecx
or     %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
shl    $0x2,%eax
and    $0x3fff0000,%eax
mov    -0x3c(%rbp),%ecx
and    $0x3fff,%ecx
or     %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
and    $0xff00ff00,%eax
shr    $0x8,%eax
mov    -0x38(%rbp),%ecx
and    $0xff00ff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
and    $0xff00ff00,%eax
shr    $0x8,%eax
mov    -0x3c(%rbp),%ecx
and    $0xff00ff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%edi
call   1030 <spdif_swab_s32@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff9,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x30(%rbp)
jmp    12a6 <bs_conv_8_14le+0x196>
mov    -0xc(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bs_conv_8_14le>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%r10
movslq %esi,%r9
imul   $0xffffffff92492493,%r9,%r14
shr    $0x20,%r14
add    %esi,%r14d
mov    %r14d,%eax
shr    $0x1f,%eax
sar    $0x2,%r14d
add    %eax,%r14d
lea    0x0(,%r14,8),%ecx
mov    %ecx,%eax
sub    %r14d,%eax
sub    %eax,%r9d
movslq %eax,%r11
mov    %ecx,0x14(%rsp)
movslq %ecx,%rbp
movslq %r9d,%rax
lea    0xe87(%rip),%rcx
test   %eax,%eax
je     12e9 <bs_conv_8_14le+0x1c9>
lea    (%r10,%r11,1),%rcx
lea    (%r15,%rbp,1),%r13
mov    %r9d,%edi
cmp    $0x8,%r9d
mov    %rbp,(%rsp)
mov    %rax,0x18(%rsp)
jb     11bb <bs_conv_8_14le+0x9b>
lea    (%r11,%rdi,1),%rax
add    %r10,%rax
cmp    %rax,%r13
jae    13c2 <bs_conv_8_14le+0x2a2>
lea    (%rdi,%rbp,1),%rax
add    %r15,%rax
cmp    %rax,%rcx
jae    13c2 <bs_conv_8_14le+0x2a2>
xor    %edx,%edx
mov    %rdx,%rax
not    %rax
add    %rdi,%rax
mov    %rdi,%rsi
and    $0x3,%rsi
je     11e3 <bs_conv_8_14le+0xc3>
nop
movzbl (%rcx,%rdx,1),%ebx
mov    %bl,0x0(%r13,%rdx,1)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rsi
jne    11d0 <bs_conv_8_14le+0xb0>
cmp    $0x3,%rax
jb     122b <bs_conv_8_14le+0x10b>
lea    (%r15,%rbp,1),%rax
add    $0x3,%rax
lea    (%r11,%r10,1),%rcx
add    $0x3,%rcx
nopl   0x0(%rax)
movzbl -0x3(%rcx,%rdx,1),%ebx
mov    %bl,-0x3(%rax,%rdx,1)
movzbl -0x2(%rcx,%rdx,1),%ebx
mov    %bl,-0x2(%rax,%rdx,1)
movzbl -0x1(%rcx,%rdx,1),%ebx
mov    %bl,-0x1(%rax,%rdx,1)
movzbl (%rcx,%rdx,1),%ebx
mov    %bl,(%rax,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%rdi
jne    1200 <bs_conv_8_14le+0xe0>
mov    %r11,0x20(%rsp)
mov    %r10,0x8(%rsp)
cmp    $0x6,%r9d
ja     1255 <bs_conv_8_14le+0x135>
add    (%rsp),%rdi
add    %r15,%rdi
mov    $0x6,%edx
sub    %r9d,%edx
add    $0x1,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    0x0(%r13),%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,%ebx
mov    0x3(%r13),%edi
call   1040 <spdif_swab_s32@plt>
mov    %ebx,%ecx
shr    $0x2,%ecx
and    $0x3fff0000,%ecx
shr    $0x4,%ebx
and    $0x3fff,%ebx
or     %ecx,%ebx
mov    %eax,%ecx
and    $0xfffc000,%ecx
and    $0x3fff,%eax
lea    (%rax,%rcx,4),%ebp
mov    %ebx,%eax
shr    $0x8,%eax
and    $0x3f003f,%eax
shl    $0x8,%ebx
and    $0xff00ff00,%ebx
or     %eax,%ebx
mov    %ebp,%eax
shr    $0x8,%eax
and    $0x3f003f,%eax
shl    $0x8,%ebp
and    $0xff00ff00,%ebp
or     %eax,%ebp
mov    %ebx,%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,0x0(%r13)
mov    %ebp,%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,0x4(%r13)
mov    0x8(%rsp),%r10
mov    0x20(%rsp),%r11
mov    (%rsp),%rbp
mov    0x18(%rsp),%rax
lea    0xd17(%rip),%rcx
mov    (%rcx,%rax,4),%eax
mov    %eax,0x8(%rsp)
add    $0x6,%r12d
cmp    $0xd,%r12d
jb     13ab <bs_conv_8_14le+0x28b>
lea    (%r15,%rbp,1),%r12
add    $0xfffffffffffffffc,%r12
lea    (%r11,%r10,1),%r15
add    $0xfffffffffffffffc,%r15
neg    %r14d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x3(%r15),%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,%ebp
mov    (%r15),%edi
call   1040 <spdif_swab_s32@plt>
mov    %ebp,%ecx
shr    $0x2,%ecx
and    $0x3fff0000,%ecx
shr    $0x4,%ebp
and    $0x3fff,%ebp
or     %ecx,%ebp
mov    %eax,%ecx
and    $0xfffc000,%ecx
and    $0x3fff,%eax
lea    (%rax,%rcx,4),%ebx
mov    %ebp,%eax
shr    $0x8,%eax
and    $0x3f003f,%eax
shl    $0x8,%ebp
and    $0xff00ff00,%ebp
or     %eax,%ebp
mov    %ebx,%eax
shr    $0x8,%eax
and    $0x3f003f,%eax
shl    $0x8,%ebx
and    $0xff00ff00,%ebx
or     %eax,%ebx
mov    %ebp,%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,-0x4(%r12,%r13,8)
mov    %ebx,%edi
call   1040 <spdif_swab_s32@plt>
mov    %eax,(%r12,%r13,8)
add    $0xffffffffffffffff,%r13
add    $0xfffffffffffffff9,%r15
cmp    %r13d,%r14d
jne    1320 <bs_conv_8_14le+0x200>
mov    0x8(%rsp),%eax
add    0x14(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x20,%r9d
jae    13cf <bs_conv_8_14le+0x2af>
xor    %edx,%edx
jmp    14c2 <bs_conv_8_14le+0x3a2>
mov    %edi,%edx
and    $0xffffffe0,%edx
lea    -0x20(%rdx),%rax
mov    %rax,%rsi
shr    $0x5,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0x60,%rax
jae    13f4 <bs_conv_8_14le+0x2d4>
xor    %ebx,%ebx
jmp    1469 <bs_conv_8_14le+0x349>
and    $0xfffffffffffffffc,%rsi
lea    (%r11,%r10,1),%rbp
add    $0x70,%rbp
mov    (%rsp),%rax
add    %r15,%rax
add    $0x70,%rax
xor    %ebx,%ebx
nopl   (%rax)
movups -0x70(%rbp,%rbx,1),%xmm0
movups -0x60(%rbp,%rbx,1),%xmm1
movups %xmm0,-0x70(%rax,%rbx,1)
movups %xmm1,-0x60(%rax,%rbx,1)
movups -0x50(%rbp,%rbx,1),%xmm0
movups -0x40(%rbp,%rbx,1),%xmm1
movups %xmm0,-0x50(%rax,%rbx,1)
movups %xmm1,-0x40(%rax,%rbx,1)
movups -0x30(%rbp,%rbx,1),%xmm0
movups -0x20(%rbp,%rbx,1),%xmm1
movups %xmm0,-0x30(%rax,%rbx,1)
movups %xmm1,-0x20(%rax,%rbx,1)
movups -0x10(%rbp,%rbx,1),%xmm0
movups 0x0(%rbp,%rbx,1),%xmm1
movups %xmm0,-0x10(%rax,%rbx,1)
movups %xmm1,(%rax,%rbx,1)
sub    $0xffffffffffffff80,%rbx
add    $0xfffffffffffffffc,%rsi
jne    1410 <bs_conv_8_14le+0x2f0>
test   %r8,%r8
je     14ab <bs_conv_8_14le+0x38b>
mov    (%rsp),%rax
add    %rbx,%rax
add    %r15,%rax
add    $0x10,%rax
add    %r11,%rbx
lea    (%r10,%rbx,1),%rsi
add    $0x10,%rsi
shl    $0x5,%r8
xor    %ebp,%ebp
nopl   (%rax)
movups -0x10(%rsi,%rbp,1),%xmm0
movups (%rsi,%rbp,1),%xmm1
movups %xmm0,-0x10(%rax,%rbp,1)
movups %xmm1,(%rax,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r8
jne    1490 <bs_conv_8_14le+0x370>
cmp    %rdi,%rdx
mov    (%rsp),%rbp
je     122b <bs_conv_8_14le+0x10b>
test   $0x18,%dil
je     11bd <bs_conv_8_14le+0x9d>
mov    %rdx,%rax
mov    %edi,%edx
and    $0xfffffff8,%edx
nopw   0x0(%rax,%rax,1)
mov    (%rcx,%rax,1),%rsi
mov    %rsi,0x0(%r13,%rax,1)
add    $0x8,%rax
cmp    %rax,%rdx
jne    14d0 <bs_conv_8_14le+0x3b0>
cmp    %rdi,%rdx
je     122b <bs_conv_8_14le+0x10b>
jmp    11bd <bs_conv_8_14le+0x9d>

LLVM IR (-O0):
@bs_conv_8_14le.inc = internal constant [7 x i32] [i32 0, i32 2, i32 4, i32 4, i32 6, i32 6, i32 8]
define i32 @bs_conv_8_14le(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%14 = load i32, i32* %5
%15 = sdiv i32 %14, 7
store i32 %15, i32* %7
%16 = load i32, i32* %5
%17 = srem i32 %16, 7
store i32 %17, i32* %8
%18 = load i8*, i8** %4
%19 = load i32, i32* %7
%20 = mul nsw i32 %19, 7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
store i8* %22, i8** %9
%23 = load i8*, i8** %6
%24 = load i32, i32* %7
%25 = mul nsw i32 %24, 8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
store i8* %27, i8** %10
%28 = load i32, i32* %7
%29 = mul nsw i32 %28, 8
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [7 x i32], [7 x i32]* @bs_conv_8_14le.inc, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %29, %33
store i32 %34, i32* %5
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %115
37: ; preds = %3
store i32 0, i32* %11
br label %38
38: ; preds = %52, %37
%39 = load i32, i32* %11
%40 = load i32, i32* %8
%41 = icmp ult i32 %39, %40
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = load i8*, i8** %9
%44 = load i32, i32* %11
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = load i8*, i8** %10
%49 = load i32, i32* %11
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 %47, i8* %51
br label %52
52: ; preds = %42
%53 = load i32, i32* %11
%54 = add i32 %53, 1
store i32 %54, i32* %11
br label %38
55: ; preds = %38
br label %56
56: ; preds = %64, %55
%57 = load i32, i32* %11
%58 = icmp ult i32 %57, 7
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i8*, i8** %10
%61 = load i32, i32* %11
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
store i8 0, i8* %63
br label %64
64: ; preds = %59
%65 = load i32, i32* %11
%66 = add i32 %65, 1
store i32 %66, i32* %11
br label %56
67: ; preds = %56
%68 = load i8*, i8** %10
%69 = getelementptr inbounds i8, i8* %68, i64 0
%70 = bitcast i8* %69 to i32*
%71 = load i32, i32* %70
%72 = call i32 @spdif_swab_s32(i32 %71)
store i32 %72, i32* %12
%73 = load i8*, i8** %10
%74 = getelementptr inbounds i8, i8* %73, i64 3
%75 = bitcast i8* %74 to i32*
%76 = load i32, i32* %75
%77 = call i32 @spdif_swab_s32(i32 %76)
store i32 %77, i32* %13
%78 = load i32, i32* %12
%79 = lshr i32 %78, 2
%80 = and i32 %79, 1073676288
%81 = load i32, i32* %12
%82 = lshr i32 %81, 4
%83 = and i32 %82, 16383
%84 = or i32 %80, %83
store i32 %84, i32* %12
%85 = load i32, i32* %13
%86 = shl i32 %85, 2
%87 = and i32 %86, 1073676288
%88 = load i32, i32* %13
%89 = and i32 %88, 16383
%90 = or i32 %87, %89
store i32 %90, i32* %13
%91 = load i32, i32* %12
%92 = and i32 %91, -16711936
%93 = lshr i32 %92, 8
%94 = load i32, i32* %12
%95 = and i32 %94, 16711935
%96 = shl i32 %95, 8
%97 = or i32 %93, %96
store i32 %97, i32* %12
%98 = load i32, i32* %13
%99 = and i32 %98, -16711936
%100 = lshr i32 %99, 8
%101 = load i32, i32* %13
%102 = and i32 %101, 16711935
%103 = shl i32 %102, 8
%104 = or i32 %100, %103
store i32 %104, i32* %13
%105 = load i32, i32* %12
%106 = call i32 @spdif_swab_s32(i32 %105)
%107 = load i8*, i8** %10
%108 = getelementptr inbounds i8, i8* %107, i64 0
%109 = bitcast i8* %108 to i32*
store i32 %106, i32* %109
%110 = load i32, i32* %13
%111 = call i32 @spdif_swab_s32(i32 %110)
%112 = load i8*, i8** %10
%113 = getelementptr inbounds i8, i8* %112, i64 4
%114 = bitcast i8* %113 to i32*
store i32 %111, i32* %114
br label %115
115: ; preds = %67, %3
%116 = load i8*, i8** %9
%117 = getelementptr inbounds i8, i8* %116, i64 -7
store i8* %117, i8** %9
%118 = load i8*, i8** %10
%119 = getelementptr inbounds i8, i8* %118, i64 -8
store i8* %119, i8** %10
br label %120
120: ; preds = %124, %115
%121 = load i32, i32* %7
%122 = add nsw i32 %121, -1
store i32 %122, i32* %7
%123 = icmp ne i32 %121, 0
br i1 %123, label %124, label %176
124: ; preds = %120
%125 = load i8*, i8** %9
%126 = getelementptr inbounds i8, i8* %125, i64 0
%127 = bitcast i8* %126 to i32*
%128 = load i32, i32* %127
%129 = call i32 @spdif_swab_s32(i32 %128)
store i32 %129, i32* %12
%130 = load i8*, i8** %9
%131 = getelementptr inbounds i8, i8* %130, i64 3
%132 = bitcast i8* %131 to i32*
%133 = load i32, i32* %132
%134 = call i32 @spdif_swab_s32(i32 %133)
store i32 %134, i32* %13
%135 = load i32, i32* %12
%136 = lshr i32 %135, 2
%137 = and i32 %136, 1073676288
%138 = load i32, i32* %12
%139 = lshr i32 %138, 4
%140 = and i32 %139, 16383
%141 = or i32 %137, %140
store i32 %141, i32* %12
%142 = load i32, i32* %13
%143 = shl i32 %142, 2
%144 = and i32 %143, 1073676288
%145 = load i32, i32* %13
%146 = and i32 %145, 16383
%147 = or i32 %144, %146
store i32 %147, i32* %13
%148 = load i32, i32* %12
%149 = and i32 %148, -16711936
%150 = lshr i32 %149, 8
%151 = load i32, i32* %12
%152 = and i32 %151, 16711935
%153 = shl i32 %152, 8
%154 = or i32 %150, %153
store i32 %154, i32* %12
%155 = load i32, i32* %13
%156 = and i32 %155, -16711936
%157 = lshr i32 %156, 8
%158 = load i32, i32* %13
%159 = and i32 %158, 16711935
%160 = shl i32 %159, 8
%161 = or i32 %157, %160
store i32 %161, i32* %13
%162 = load i32, i32* %12
%163 = call i32 @spdif_swab_s32(i32 %162)
%164 = load i8*, i8** %10
%165 = getelementptr inbounds i8, i8* %164, i64 0
%166 = bitcast i8* %165 to i32*
store i32 %163, i32* %166
%167 = load i32, i32* %13
%168 = call i32 @spdif_swab_s32(i32 %167)
%169 = load i8*, i8** %10
%170 = getelementptr inbounds i8, i8* %169, i64 4
%171 = bitcast i8* %170 to i32*
store i32 %168, i32* %171
%172 = load i8*, i8** %9
%173 = getelementptr inbounds i8, i8* %172, i64 -7
store i8* %173, i8** %9
%174 = load i8*, i8** %10
%175 = getelementptr inbounds i8, i8* %174, i64 -8
store i8* %175, i8** %10
br label %120
176: ; preds = %120
%177 = load i32, i32* %5
ret i32 %177
}

LLVM IR (-O2):
@bs_conv_8_14le.inc = internal unnamed_addr constant [7 x i32] [i32 0, i32 2, i32 4, i32 4, i32 6, i32 6, i32 8]
define i32 @bs_conv_8_14le(i8* nocapture %0, i32 %1, i8* nocapture %2) {
%4 = sdiv i32 %1, 7
%5 = srem i32 %1, 7
%6 = mul nsw i32 %4, 7
%7 = sext i32 %6 to i64
%8 = getelementptr i8, i8* %0, i64 %7
%9 = shl nsw i32 %4, 3
%10 = sext i32 %9 to i64
%11 = getelementptr i8, i8* %2, i64 %10
%12 = sext i32 %5 to i64
%13 = getelementptr inbounds [7 x i32], [7 x i32]* @bs_conv_8_14le.inc, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %5, 0
br i1 %15, label %202, label %16
16: ; preds = %3
%17 = zext i32 %5 to i64
%18 = icmp ult i32 %5, 8
br i1 %18, label %125, label %19
19: ; preds = %16
%20 = add nsw i64 %10, %17
%21 = getelementptr i8, i8* %2, i64 %20
%22 = add nsw i64 %7, %17
%23 = getelementptr i8, i8* %0, i64 %22
%24 = icmp ult i8* %11, %23
%25 = icmp ult i8* %8, %21
%26 = and i1 %24, %25
br i1 %26, label %125, label %27
27: ; preds = %19
%28 = icmp ult i32 %5, 32
br i1 %28, label %111, label %29
29: ; preds = %27
%30 = and i64 %17, 4294967264
%31 = add nsw i64 %30, -32
%32 = lshr exact i64 %31, 5
%33 = add nuw nsw i64 %32, 1
%34 = and i64 %33, 3
%35 = icmp ult i64 %31, 96
br i1 %35, label %87, label %36
36: ; preds = %29
%37 = and i64 %33, 1152921504606846972
br label %38
38: ; preds = %38, %36
%39 = phi i64 [ 0, %36 ], [ %84, %38 ]
%40 = phi i64 [ 0, %36 ], [ %85, %38 ]
%41 = getelementptr inbounds i8, i8* %8, i64 %39
%42 = bitcast i8* %41 to <16 x i8>*
%43 = load <16 x i8>, <16 x i8>* %42
%44 = getelementptr inbounds i8, i8* %41, i64 16
%45 = bitcast i8* %44 to <16 x i8>*
%46 = load <16 x i8>, <16 x i8>* %45
%47 = getelementptr inbounds i8, i8* %11, i64 %39
%48 = bitcast i8* %47 to <16 x i8>*
store <16 x i8> %43, <16 x i8>* %48
%49 = getelementptr inbounds i8, i8* %47, i64 16
%50 = bitcast i8* %49 to <16 x i8>*
store <16 x i8> %46, <16 x i8>* %50
%51 = or i64 %39, 32
%52 = getelementptr inbounds i8, i8* %8, i64 %51
%53 = bitcast i8* %52 to <16 x i8>*
%54 = load <16 x i8>, <16 x i8>* %53
%55 = getelementptr inbounds i8, i8* %52, i64 16
%56 = bitcast i8* %55 to <16 x i8>*
%57 = load <16 x i8>, <16 x i8>* %56
%58 = getelementptr inbounds i8, i8* %11, i64 %51
%59 = bitcast i8* %58 to <16 x i8>*
store <16 x i8> %54, <16 x i8>* %59
%60 = getelementptr inbounds i8, i8* %58, i64 16
%61 = bitcast i8* %60 to <16 x i8>*
store <16 x i8> %57, <16 x i8>* %61
%62 = or i64 %39, 64
%63 = getelementptr inbounds i8, i8* %8, i64 %62
%64 = bitcast i8* %63 to <16 x i8>*
%65 = load <16 x i8>, <16 x i8>* %64
%66 = getelementptr inbounds i8, i8* %63, i64 16
%67 = bitcast i8* %66 to <16 x i8>*
%68 = load <16 x i8>, <16 x i8>* %67
%69 = getelementptr inbounds i8, i8* %11, i64 %62
%70 = bitcast i8* %69 to <16 x i8>*
store <16 x i8> %65, <16 x i8>* %70
%71 = getelementptr inbounds i8, i8* %69, i64 16
%72 = bitcast i8* %71 to <16 x i8>*
store <16 x i8> %68, <16 x i8>* %72
%73 = or i64 %39, 96
%74 = getelementptr inbounds i8, i8* %8, i64 %73
%75 = bitcast i8* %74 to <16 x i8>*
%76 = load <16 x i8>, <16 x i8>* %75
%77 = getelementptr inbounds i8, i8* %74, i64 16
%78 = bitcast i8* %77 to <16 x i8>*
%79 = load <16 x i8>, <16 x i8>* %78
%80 = getelementptr inbounds i8, i8* %11, i64 %73
%81 = bitcast i8* %80 to <16 x i8>*
store <16 x i8> %76, <16 x i8>* %81
%82 = getelementptr inbounds i8, i8* %80, i64 16
%83 = bitcast i8* %82 to <16 x i8>*
store <16 x i8> %79, <16 x i8>* %83
%84 = add nuw i64 %39, 128
%85 = add i64 %40, 4
%86 = icmp eq i64 %85, %37
br i1 %86, label %87, label %38
87: ; preds = %38, %29
%88 = phi i64 [ 0, %29 ], [ %84, %38 ]
%89 = icmp eq i64 %34, 0
br i1 %89, label %106, label %90
90: ; preds = %87, %90
%91 = phi i64 [ %103, %90 ], [ %88, %87 ]
%92 = phi i64 [ %104, %90 ], [ 0, %87 ]
%93 = getelementptr inbounds i8, i8* %8, i64 %91
%94 = bitcast i8* %93 to <16 x i8>*
%95 = load <16 x i8>, <16 x i8>* %94
%96 = getelementptr inbounds i8, i8* %93, i64 16
%97 = bitcast i8* %96 to <16 x i8>*
%98 = load <16 x i8>, <16 x i8>* %97
%99 = getelementptr inbounds i8, i8* %11, i64 %91
%100 = bitcast i8* %99 to <16 x i8>*
store <16 x i8> %95, <16 x i8>* %100
%101 = getelementptr inbounds i8, i8* %99, i64 16
%102 = bitcast i8* %101 to <16 x i8>*
store <16 x i8> %98, <16 x i8>* %102
%103 = add nuw i64 %91, 32
%104 = add i64 %92, 1
%105 = icmp eq i64 %104, %34
br i1 %105, label %106, label %90
106: ; preds = %90, %87
%107 = icmp eq i64 %30, %17
br i1 %107, label %143, label %108
108: ; preds = %106
%109 = and i64 %17, 24
%110 = icmp eq i64 %109, 0
br i1 %110, label %125, label %111
111: ; preds = %27, %108
%112 = phi i64 [ %30, %108 ], [ 0, %27 ]
%113 = and i64 %17, 4294967288
br label %114
114: ; preds = %114, %111
%115 = phi i64 [ %112, %111 ], [ %121, %114 ]
%116 = getelementptr inbounds i8, i8* %8, i64 %115
%117 = bitcast i8* %116 to <8 x i8>*
%118 = load <8 x i8>, <8 x i8>* %117
%119 = getelementptr inbounds i8, i8* %11, i64 %115
%120 = bitcast i8* %119 to <8 x i8>*
store <8 x i8> %118, <8 x i8>* %120
%121 = add nuw i64 %115, 8
%122 = icmp eq i64 %121, %113
br i1 %122, label %123, label %114
123: ; preds = %114
%124 = icmp eq i64 %113, %17
br i1 %124, label %143, label %125
125: ; preds = %19, %16, %108, %123
%126 = phi i64 [ 0, %16 ], [ 0, %19 ], [ %30, %108 ], [ %113, %123 ]
%127 = xor i64 %126, -1
%128 = add nsw i64 %127, %17
%129 = and i64 %17, 3
%130 = icmp eq i64 %129, 0
br i1 %130, label %140, label %131
131: ; preds = %125, %131
%132 = phi i64 [ %137, %131 ], [ %126, %125 ]
%133 = phi i64 [ %138, %131 ], [ 0, %125 ]
%134 = getelementptr inbounds i8, i8* %8, i64 %132
%135 = load i8, i8* %134
%136 = getelementptr inbounds i8, i8* %11, i64 %132
store i8 %135, i8* %136
%137 = add nuw nsw i64 %132, 1
%138 = add i64 %133, 1
%139 = icmp eq i64 %138, %129
br i1 %139, label %140, label %131
140: ; preds = %131, %125
%141 = phi i64 [ %126, %125 ], [ %137, %131 ]
%142 = icmp ult i64 %128, 3
br i1 %142, label %143, label %152
143: ; preds = %140, %152, %123, %106
%144 = icmp ult i32 %5, 7
br i1 %144, label %145, label %171
145: ; preds = %143
%146 = zext i32 %5 to i64
%147 = add nsw i64 %10, %146
%148 = getelementptr i8, i8* %2, i64 %147
%149 = sub nuw nsw i32 6, %5
%150 = zext i32 %149 to i64
%151 = add nuw nsw i64 %150, 1
br label %171
152: ; preds = %140, %152
%153 = phi i64 [ %169, %152 ], [ %141, %140 ]
%154 = getelementptr inbounds i8, i8* %8, i64 %153
%155 = load i8, i8* %154
%156 = getelementptr inbounds i8, i8* %11, i64 %153
store i8 %155, i8* %156
%157 = add nuw nsw i64 %153, 1
%158 = getelementptr inbounds i8, i8* %8, i64 %157
%159 = load i8, i8* %158
%160 = getelementptr inbounds i8, i8* %11, i64 %157
store i8 %159, i8* %160
%161 = add nuw nsw i64 %153, 2
%162 = getelementptr inbounds i8, i8* %8, i64 %161
%163 = load i8, i8* %162
%164 = getelementptr inbounds i8, i8* %11, i64 %161
store i8 %163, i8* %164
%165 = add nuw nsw i64 %153, 3
%166 = getelementptr inbounds i8, i8* %8, i64 %165
%167 = load i8, i8* %166
%168 = getelementptr inbounds i8, i8* %11, i64 %165
store i8 %167, i8* %168
%169 = add nuw nsw i64 %153, 4
%170 = icmp eq i64 %169, %17
br i1 %170, label %143, label %152
171: ; preds = %145, %143
%172 = bitcast i8* %11 to i32*
%173 = load i32, i32* %172
%174 = tail call i32 @spdif_swab_s32(i32 %173)
%175 = getelementptr inbounds i8, i8* %11, i64 3
%176 = bitcast i8* %175 to i32*
%177 = load i32, i32* %176
%178 = tail call i32 @spdif_swab_s32(i32 %177)
%179 = lshr i32 %174, 2
%180 = and i32 %179, 1073676288
%181 = lshr i32 %174, 4
%182 = and i32 %181, 16383
%183 = or i32 %180, %182
%184 = shl i32 %178, 2
%185 = and i32 %184, 1073676288
%186 = and i32 %178, 16383
%187 = or i32 %185, %186
%188 = lshr i32 %183, 8
%189 = and i32 %188, 4128831
%190 = shl i32 %183, 8
%191 = and i32 %190, -16711936
%192 = or i32 %189, %191
%193 = lshr i32 %187, 8
%194 = and i32 %193, 4128831
%195 = shl i32 %187, 8
%196 = and i32 %195, -16711936
%197 = or i32 %194, %196
%198 = tail call i32 @spdif_swab_s32(i32 %192)
store i32 %198, i32* %172
%199 = tail call i32 @spdif_swab_s32(i32 %197)
%200 = getelementptr inbounds i8, i8* %11, i64 4
%201 = bitcast i8* %200 to i32*
store i32 %199, i32* %201
br label %202
202: ; preds = %171, %3
%203 = add i32 %1, 6
%204 = icmp ult i32 %203, 13
br i1 %204, label %244, label %205
205: ; preds = %202, %205
%206 = phi i8* [ %209, %205 ], [ %11, %202 ]
%207 = phi i8* [ %210, %205 ], [ %8, %202 ]
%208 = phi i32 [ %211, %205 ], [ %4, %202 ]
%209 = getelementptr inbounds i8, i8* %206, i64 -8
%210 = getelementptr inbounds i8, i8* %207, i64 -7
%211 = add nsw i32 %208, -1
%212 = bitcast i8* %210 to i32*
%213 = load i32, i32* %212
%214 = tail call i32 @spdif_swab_s32(i32 %213)
%215 = getelementptr inbounds i8, i8* %207, i64 -4
%216 = bitcast i8* %215 to i32*
%217 = load i32, i32* %216
%218 = tail call i32 @spdif_swab_s32(i32 %217)
%219 = lshr i32 %214, 2
%220 = and i32 %219, 1073676288
%221 = lshr i32 %214, 4
%222 = and i32 %221, 16383
%223 = or i32 %220, %222
%224 = shl i32 %218, 2
%225 = and i32 %224, 1073676288
%226 = and i32 %218, 16383
%227 = or i32 %225, %226
%228 = lshr i32 %223, 8
%229 = and i32 %228, 4128831
%230 = shl i32 %223, 8
%231 = and i32 %230, -16711936
%232 = or i32 %229, %231
%233 = lshr i32 %227, 8
%234 = and i32 %233, 4128831
%235 = shl i32 %227, 8
%236 = and i32 %235, -16711936
%237 = or i32 %234, %236
%238 = tail call i32 @spdif_swab_s32(i32 %232)
%239 = bitcast i8* %209 to i32*
store i32 %238, i32* %239
%240 = tail call i32 @spdif_swab_s32(i32 %237)
%241 = getelementptr inbounds i8, i8* %206, i64 -4
%242 = bitcast i8* %241 to i32*
store i32 %240, i32* %242
%243 = icmp eq i32 %211, 0
br i1 %243, label %244, label %205
244: ; preds = %205, %202
%245 = add nsw i32 %14, %9
ret i32 %245
}