void Pack(block, bit, blockLen) unsigned char *block;
unsigned char *bit;
unsigned int blockLen;
{
  unsigned int i, j;
  unsigned char t;
  for (i = 0; i < blockLen; i++) {
    t = 0;
    for (j = 0; j < 8; j++)
      t |= bit[8 * i + j] << (7 - j);
    block[i] = t;
  }
}


x86 assembly (clang, -O0):
<Pack>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1188 <Pack+0x88>
movb   $0x0,-0x1d(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jae    116d <Pack+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
add    -0x1c(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    $0x7,%ecx
sub    -0x1c(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x1d(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1d(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <Pack+0x2d>
mov    -0x1d(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <Pack+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pack>:
push   %rbx
sub    $0x130,%rsp
test   %edx,%edx
je     1b43 <Pack+0xa43>
mov    %edx,%r9d
xor    %r11d,%r11d
cmp    $0x10,%edx
jb     1ac9 <Pack+0x9c9>
lea    -0x20000001(%r9),%rax
cmp    $0xffffffffe0000000,%rax
jb     1ac9 <Pack+0x9c9>
lea    (%rsi,%r9,8),%rax
cmp    %rdi,%rax
jbe    114c <Pack+0x4c>
lea    (%rdi,%r9,1),%rax
cmp    %rsi,%rax
jbe    114c <Pack+0x4c>
xor    %r11d,%r11d
jmp    1ac9 <Pack+0x9c9>
mov    %r9d,%r11d
and    $0xfffffff0,%r11d
lea    0x0(,%r9,8),%r8
and    $0xffffffffffffff80,%r8
xor    %eax,%eax
mov    %rdi,%r10
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%edx
and    $0xffffff80,%edx
movdqu (%rsi,%rdx,1),%xmm13
movdqu 0x10(%rsi,%rdx,1),%xmm8
movdqu 0x20(%rsi,%rdx,1),%xmm5
movdqu 0x30(%rsi,%rdx,1),%xmm12
movdqu 0x40(%rsi,%rdx,1),%xmm2
movdqa %xmm2,-0x40(%rsp)
movdqu 0x50(%rsi,%rdx,1),%xmm14
movdqu 0x60(%rsi,%rdx,1),%xmm10
movdqu 0x70(%rsi,%rdx,1),%xmm6
movdqa %xmm6,%xmm0
movdqa 0xe45(%rip),%xmm3
pand   %xmm3,%xmm0
movdqa %xmm10,%xmm1
pand   %xmm3,%xmm1
packuswb %xmm0,%xmm1
packuswb %xmm1,%xmm0
movdqa %xmm14,%xmm1
pand   %xmm3,%xmm1
pand   %xmm3,%xmm2
packuswb %xmm1,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm0,%xmm2
movdqa %xmm12,%xmm0
pand   %xmm3,%xmm0
movdqa %xmm5,%xmm1
pand   %xmm3,%xmm1
packuswb %xmm0,%xmm1
packuswb %xmm1,%xmm0
movdqa %xmm8,%xmm1
pand   %xmm3,%xmm1
movdqa %xmm13,%xmm11
pand   %xmm3,%xmm11
packuswb %xmm1,%xmm11
packuswb %xmm11,%xmm11
packuswb %xmm0,%xmm11
shufps $0xcc,%xmm2,%xmm11
movdqa %xmm8,%xmm0
pxor   %xmm9,%xmm9
punpckhbw %xmm9,%xmm0
movdqa %xmm0,0x120(%rsp)
movdqa %xmm8,%xmm7
punpcklbw %xmm9,%xmm7
movdqa %xmm7,0x50(%rsp)
punpcklwd %xmm0,%xmm7
packuswb %xmm7,%xmm7
movdqa 0xdaf(%rip),%xmm1
movdqa %xmm1,%xmm0
pandn  %xmm7,%xmm0
movdqa %xmm13,%xmm2
punpckhbw %xmm9,%xmm2
movdqa %xmm2,0x110(%rsp)
movdqa %xmm13,%xmm15
punpcklbw %xmm9,%xmm15
movdqa %xmm15,0x40(%rsp)
punpcklwd %xmm2,%xmm15
movdqa %xmm15,0x60(%rsp)
pshufd $0x55,%xmm15,%xmm4
packuswb %xmm4,%xmm4
pand   %xmm1,%xmm4
por    %xmm0,%xmm4
movdqa %xmm12,0x70(%rsp)
movdqa %xmm12,%xmm0
punpckhbw %xmm9,%xmm0
movdqa %xmm0,0x100(%rsp)
punpcklbw %xmm9,%xmm12
movdqa %xmm12,0x30(%rsp)
punpcklwd %xmm0,%xmm12
packuswb %xmm12,%xmm12
pshufd $0xe0,%xmm12,%xmm0
movdqa 0xd37(%rip),%xmm1
movdqa %xmm1,%xmm2
pandn  %xmm0,%xmm2
movdqa %xmm5,-0x50(%rsp)
movdqa %xmm5,%xmm0
punpckhbw %xmm9,%xmm0
movdqa %xmm0,0xf0(%rsp)
punpcklbw %xmm9,%xmm5
movdqa %xmm5,0x20(%rsp)
punpcklwd %xmm0,%xmm5
pshufd $0xd4,%xmm5,%xmm0
packuswb %xmm0,%xmm0
pand   %xmm1,%xmm0
por    %xmm2,%xmm0
pshufd $0x55,%xmm0,%xmm0
punpckldq %xmm0,%xmm4
movdqa %xmm6,-0x60(%rsp)
movdqa %xmm6,%xmm2
punpckhbw %xmm9,%xmm2
movdqa %xmm2,0xd0(%rsp)
punpcklbw %xmm9,%xmm6
movdqa %xmm6,0xe0(%rsp)
punpcklwd %xmm2,%xmm6
packuswb %xmm6,%xmm0
movdqa %xmm0,-0x10(%rsp)
pshufd $0xa4,%xmm0,%xmm0
movdqa 0xcbd(%rip),%xmm1
movdqa %xmm1,%xmm2
pandn  %xmm0,%xmm2
movdqa %xmm10,-0x70(%rsp)
movdqa %xmm10,%xmm0
punpckhbw %xmm9,%xmm0
movdqa %xmm0,0xc0(%rsp)
punpcklbw %xmm9,%xmm10
movdqa %xmm10,0x10(%rsp)
movdqa %xmm10,%xmm15
punpcklwd %xmm0,%xmm15
pshufd $0xd4,%xmm15,%xmm0
packuswb %xmm0,%xmm0
pand   %xmm1,%xmm0
por    %xmm2,%xmm0
movdqa %xmm14,-0x80(%rsp)
movdqa %xmm14,%xmm6
punpckhbw %xmm9,%xmm6
movdqa %xmm6,0xa0(%rsp)
punpcklbw %xmm9,%xmm14
movdqa %xmm14,0xb0(%rsp)
punpcklwd %xmm6,%xmm14
packuswb %xmm14,%xmm1
movdqa %xmm1,-0x20(%rsp)
movdqa 0xc42(%rip),%xmm3
movdqa %xmm3,%xmm10
pandn  %xmm1,%xmm10
movdqa -0x40(%rsp),%xmm2
movdqa %xmm2,%xmm14
punpckhbw %xmm9,%xmm14
movdqa %xmm14,0x90(%rsp)
punpcklbw %xmm9,%xmm2
movdqa %xmm2,(%rsp)
punpcklwd %xmm14,%xmm2
pshufd $0x55,%xmm2,%xmm14
packuswb %xmm14,%xmm6
pand   %xmm3,%xmm6
por    %xmm10,%xmm6
pshufd $0xaa,%xmm6,%xmm10
punpckhdq %xmm0,%xmm10
movsd  %xmm4,%xmm10
movdqa 0xbf2(%rip),%xmm9
pand   %xmm9,%xmm8
movdqa %xmm8,-0x30(%rsp)
pshufd $0xe8,%xmm8,%xmm0
pshuflw $0xd4,%xmm0,%xmm0
packuswb %xmm0,%xmm0
movdqa 0xb8f(%rip),%xmm1
movdqa %xmm1,%xmm4
pandn  %xmm0,%xmm4
pand   %xmm9,%xmm13
movdqa %xmm13,0x80(%rsp)
pshufd $0xe8,%xmm13,%xmm0
pshuflw $0xed,%xmm0,%xmm14
packuswb %xmm14,%xmm14
pand   %xmm1,%xmm14
por    %xmm4,%xmm14
movdqa 0x70(%rsp),%xmm13
pand   %xmm9,%xmm13
pshufd $0x24,%xmm13,%xmm4
pshufhw $0x74,%xmm4,%xmm4
packuswb %xmm4,%xmm4
movdqa 0xb4a(%rip),%xmm1
movdqa %xmm1,%xmm6
pandn  %xmm4,%xmm6
movdqa -0x50(%rsp),%xmm0
pand   %xmm9,%xmm0
movdqa %xmm0,-0x50(%rsp)
pshufd $0x24,%xmm0,%xmm4
pshufhw $0xe7,%xmm4,%xmm4
packuswb %xmm4,%xmm4
pand   %xmm1,%xmm4
por    %xmm6,%xmm4
pshufd $0x55,%xmm4,%xmm4
punpckldq %xmm4,%xmm14
movdqa -0x60(%rsp),%xmm0
pand   %xmm9,%xmm0
movdqa %xmm0,-0x60(%rsp)
pshufd $0x24,%xmm0,%xmm4
pshufhw $0x74,%xmm4,%xmm4
packuswb %xmm4,%xmm4
movdqa 0xaf9(%rip),%xmm8
movdqa %xmm8,%xmm6
pandn  %xmm4,%xmm6
movdqa -0x70(%rsp),%xmm0
pand   %xmm9,%xmm0
movdqa %xmm0,-0x70(%rsp)
pshufd $0x24,%xmm0,%xmm4
pshufhw $0xe7,%xmm4,%xmm4
packuswb %xmm4,%xmm1
pand   %xmm8,%xmm1
por    %xmm6,%xmm1
movdqa -0x80(%rsp),%xmm0
pand   %xmm9,%xmm0
movdqa %xmm0,-0x80(%rsp)
pshufd $0xe8,%xmm0,%xmm4
pshuflw $0xd4,%xmm4,%xmm4
packuswb %xmm4,%xmm4
movdqa %xmm3,%xmm6
pandn  %xmm4,%xmm6
movdqa -0x40(%rsp),%xmm0
pand   %xmm9,%xmm0
movdqa %xmm0,-0x40(%rsp)
pshufd $0xe8,%xmm0,%xmm4
pshuflw $0xed,%xmm4,%xmm4
packuswb %xmm4,%xmm4
pand   %xmm3,%xmm4
movdqa %xmm3,%xmm8
por    %xmm6,%xmm4
pshufd $0xaa,%xmm4,%xmm9
punpckhdq %xmm1,%xmm9
movsd  %xmm14,%xmm9
pshufd $0xe5,%xmm7,%xmm0
movdqa 0xa37(%rip),%xmm14
movdqa %xmm14,%xmm6
pandn  %xmm0,%xmm6
pshufd $0xff,0x60(%rsp),%xmm1
packuswb %xmm1,%xmm1
pand   %xmm14,%xmm1
por    %xmm6,%xmm1
movdqa 0xa22(%rip),%xmm4
movdqa %xmm4,%xmm0
pandn  %xmm12,%xmm0
pshufd $0xfa,%xmm5,%xmm5
packuswb %xmm5,%xmm5
pand   %xmm4,%xmm5
movdqa %xmm4,%xmm7
por    %xmm0,%xmm5
pshufd $0x55,%xmm5,%xmm0
punpckldq %xmm0,%xmm1
movdqa 0xa03(%rip),%xmm4
movdqa %xmm4,%xmm0
pandn  -0x10(%rsp),%xmm0
pshufd $0xfa,%xmm15,%xmm3
packuswb %xmm3,%xmm3
pand   %xmm4,%xmm3
movdqa %xmm4,%xmm6
por    %xmm0,%xmm3
pshufd $0xf4,-0x20(%rsp),%xmm0
movdqa %xmm8,%xmm5
pandn  %xmm0,%xmm5
pshufd $0xff,%xmm2,%xmm0
packuswb %xmm0,%xmm0
pand   %xmm8,%xmm0
por    %xmm5,%xmm0
pshufd $0xaa,%xmm0,%xmm0
punpckhdq %xmm3,%xmm0
movsd  %xmm1,%xmm0
pshufd $0xe7,-0x30(%rsp),%xmm1
movdqa %xmm1,-0x10(%rsp)
pshuflw $0x24,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa %xmm14,%xmm3
pandn  %xmm1,%xmm3
pshufd $0xe7,0x80(%rsp),%xmm1
movdqa %xmm1,-0x20(%rsp)
pshuflw $0xe2,%xmm1,%xmm2
packuswb %xmm2,%xmm2
pand   %xmm14,%xmm2
por    %xmm3,%xmm2
pshufd $0xd4,%xmm13,%xmm1
movdqa %xmm1,-0x30(%rsp)
pshufhw $0x84,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa %xmm7,%xmm3
pandn  %xmm1,%xmm3
pshufd $0xd4,-0x50(%rsp),%xmm1
movdqa %xmm1,-0x50(%rsp)
pshufhw $0xe8,%xmm1,%xmm1
packuswb %xmm1,%xmm1
pand   %xmm7,%xmm1
por    %xmm3,%xmm1
pshufd $0x55,%xmm1,%xmm1
punpckldq %xmm1,%xmm2
pshufd $0xd4,-0x60(%rsp),%xmm1
movdqa %xmm1,-0x60(%rsp)
pshufhw $0x84,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa %xmm4,%xmm3
pandn  %xmm1,%xmm3
pshufd $0xd4,-0x70(%rsp),%xmm1
movdqa %xmm1,-0x70(%rsp)
pshufhw $0xe8,%xmm1,%xmm1
packuswb %xmm1,%xmm6
pand   %xmm4,%xmm6
por    %xmm3,%xmm6
pshufd $0xe7,-0x80(%rsp),%xmm1
movdqa %xmm1,-0x80(%rsp)
pshuflw $0x24,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movdqa %xmm8,%xmm3
pandn  %xmm1,%xmm3
pshufd $0xe7,-0x40(%rsp),%xmm15
e7
pshuflw $0xe2,%xmm15,%xmm1
packuswb %xmm1,%xmm1
pand   %xmm8,%xmm1
movdqa %xmm8,%xmm13
por    %xmm3,%xmm1
pshufd $0xaa,%xmm1,%xmm1
punpckhdq %xmm6,%xmm1
movsd  %xmm2,%xmm1
movdqa 0x50(%rsp),%xmm2
punpckhwd 0x120(%rsp),%xmm2
movdqa 0x40(%rsp),%xmm6
punpckhwd 0x110(%rsp),%xmm6
movdqa %xmm6,0x40(%rsp)
packuswb %xmm2,%xmm2
movdqa %xmm2,0x50(%rsp)
movdqa %xmm14,%xmm5
movdqa %xmm14,%xmm3
pandn  %xmm2,%xmm3
pshufd $0x55,%xmm6,%xmm2
packuswb %xmm2,%xmm2
pand   %xmm14,%xmm2
por    %xmm3,%xmm2
movdqa 0x30(%rsp),%xmm3
punpckhwd 0x100(%rsp),%xmm3
packuswb %xmm3,%xmm3
movdqa %xmm3,0x30(%rsp)
pshufd $0xe0,%xmm3,%xmm3
movdqa %xmm7,%xmm6
pandn  %xmm3,%xmm6
movdqa 0x20(%rsp),%xmm3
punpckhwd 0xf0(%rsp),%xmm3
movdqa %xmm3,0x20(%rsp)
pshufd $0xd4,%xmm3,%xmm3
packuswb %xmm3,%xmm3
pand   %xmm7,%xmm3
por    %xmm6,%xmm3
pshufd $0x55,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
movdqa 0xe0(%rsp),%xmm3
punpckhwd 0xd0(%rsp),%xmm3
packuswb %xmm3,%xmm8
pshufd $0xa4,%xmm8,%xmm14
movdqa %xmm4,%xmm3
pandn  %xmm14,%xmm3
movdqa 0x10(%rsp),%xmm5
punpckhwd 0xc0(%rsp),%xmm5
movdqa %xmm5,0x10(%rsp)
pshufd $0xd4,%xmm5,%xmm5
packuswb %xmm5,%xmm5
pand   %xmm4,%xmm5
por    %xmm3,%xmm5
movdqa 0xb0(%rsp),%xmm3
punpckhwd 0xa0(%rsp),%xmm3
movdqa (%rsp),%xmm4
punpckhwd 0x90(%rsp),%xmm4
movdqa %xmm4,(%rsp)
packuswb %xmm3,%xmm14
movdqa %xmm13,%xmm3
pandn  %xmm14,%xmm3
pshufd $0x55,%xmm4,%xmm12
packuswb %xmm12,%xmm6
pand   %xmm13,%xmm6
por    %xmm3,%xmm6
pshufd $0xaa,%xmm6,%xmm12
punpckhdq %xmm5,%xmm12
movsd  %xmm2,%xmm12
pshuflw $0x74,-0x10(%rsp),%xmm2
packuswb %xmm2,%xmm2
movdqa 0x72d(%rip),%xmm3
movdqa %xmm3,%xmm5
pandn  %xmm2,%xmm5
pshuflw $0xe7,-0x20(%rsp),%xmm2
packuswb %xmm2,%xmm2
pand   %xmm3,%xmm2
por    %xmm5,%xmm2
pshufhw $0xd4,-0x30(%rsp),%xmm5
packuswb %xmm5,%xmm5
movdqa 0x70f(%rip),%xmm7
movdqa %xmm7,%xmm6
pandn  %xmm5,%xmm6
pshufhw $0xed,-0x50(%rsp),%xmm5
packuswb %xmm5,%xmm5
pand   %xmm7,%xmm5
por    %xmm6,%xmm5
pshufd $0x55,%xmm5,%xmm5
punpckldq %xmm5,%xmm2
pshufhw $0xd4,-0x60(%rsp),%xmm5
packuswb %xmm5,%xmm5
movdqa 0x6e8(%rip),%xmm4
movdqa %xmm4,%xmm6
pandn  %xmm5,%xmm6
pshufhw $0xed,-0x70(%rsp),%xmm5
packuswb %xmm5,%xmm3
pand   %xmm4,%xmm3
por    %xmm6,%xmm3
pshuflw $0x74,-0x80(%rsp),%xmm5
packuswb %xmm5,%xmm5
movdqa %xmm13,%xmm6
pandn  %xmm5,%xmm6
pshuflw $0xe7,%xmm15,%xmm5
packuswb %xmm5,%xmm5
pand   %xmm13,%xmm5
por    %xmm6,%xmm5
pshufd $0xaa,%xmm5,%xmm5
punpckhdq %xmm3,%xmm5
movsd  %xmm2,%xmm5
pshufd $0xe5,0x50(%rsp),%xmm2
movdqa 0x66a(%rip),%xmm6
movdqa %xmm6,%xmm3
pandn  %xmm2,%xmm3
pshufd $0xff,0x40(%rsp),%xmm2
packuswb %xmm2,%xmm2
pand   %xmm6,%xmm2
por    %xmm3,%xmm2
movdqa %xmm7,%xmm3
pandn  0x30(%rsp),%xmm3
pshufd $0xfa,0x20(%rsp),%xmm6
packuswb %xmm6,%xmm6
pand   %xmm7,%xmm6
por    %xmm3,%xmm6
pshufd $0x55,%xmm6,%xmm3
punpckldq %xmm3,%xmm2
movdqa %xmm4,%xmm3
pandn  %xmm8,%xmm3
pshufd $0xfa,0x10(%rsp),%xmm6
packuswb %xmm6,%xmm6
pand   %xmm4,%xmm6
por    %xmm3,%xmm6
pshufd $0xf4,%xmm14,%xmm8
movdqa %xmm13,%xmm3
pandn  %xmm8,%xmm3
pshufd $0xff,(%rsp),%xmm4
packuswb %xmm4,%xmm4
pand   %xmm13,%xmm4
por    %xmm3,%xmm4
pshufd $0xaa,%xmm4,%xmm3
punpckhdq %xmm6,%xmm3
movsd  %xmm2,%xmm3
psllw  $0x7,%xmm11
pand   0x61e(%rip),%xmm11
psllw  $0x6,%xmm10
pand   0x61f(%rip),%xmm10
por    %xmm11,%xmm10
psllw  $0x5,%xmm9
pand   0x61b(%rip),%xmm9
psllw  $0x4,%xmm0
pand   0x61e(%rip),%xmm0
por    %xmm9,%xmm0
por    %xmm10,%xmm0
psllw  $0x3,%xmm1
pand   0x617(%rip),%xmm1
psllw  $0x2,%xmm12
pand   0x618(%rip),%xmm12
por    %xmm1,%xmm12
paddb  %xmm5,%xmm5
por    %xmm12,%xmm5
por    %xmm0,%xmm5
por    %xmm3,%xmm5
movdqu %xmm5,(%r10)
sub    $0xffffffffffffff80,%rax
add    $0x10,%r10
cmp    %rax,%r8
jne    1170 <Pack+0x70>
cmp    %r9,%r11
je     1b43 <Pack+0xa43>
lea    0x0(,%r11,8),%r8
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r8d,%edx
and    $0xfffffff8,%edx
movzbl (%rsi,%rdx,1),%ecx
movzbl 0x1(%rsi,%rdx,1),%eax
shl    $0x7,%cl
shl    $0x6,%al
or     %cl,%al
movzbl 0x2(%rsi,%rdx,1),%r10d
shl    $0x5,%r10b
movzbl 0x3(%rsi,%rdx,1),%ebx
shl    $0x4,%bl
or     %r10b,%bl
or     %al,%bl
movzbl 0x4(%rsi,%rdx,1),%r10d
shl    $0x3,%r10b
movzbl 0x5(%rsi,%rdx,1),%eax
shl    $0x2,%al
or     %r10b,%al
movzbl 0x6(%rsi,%rdx,1),%ecx
add    %cl,%cl
or     %al,%cl
or     %bl,%cl
or     0x7(%rsi,%rdx,1),%cl
mov    %cl,(%rdi,%r11,1)
add    $0x1,%r11
add    $0x8,%r8
cmp    %r11,%r9
jne    1ae0 <Pack+0x9e0>
add    $0x130,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @Pack(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %44, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %47
14: ; preds = %10
store i8 0, i8* %9
store i32 0, i32* %8
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %8
%17 = icmp ult i32 %16, 8
br i1 %17, label %18, label %38
18: ; preds = %15
%19 = load i8*, i8** %5
%20 = load i32, i32* %7
%21 = mul i32 8, %20
%22 = load i32, i32* %8
%23 = add i32 %21, %22
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %19, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i32, i32* %8
%29 = sub i32 7, %28
%30 = shl i32 %27, %29
%31 = load i8, i8* %9
%32 = zext i8 %31 to i32
%33 = or i32 %32, %30
%34 = trunc i32 %33 to i8
store i8 %34, i8* %9
br label %35
35: ; preds = %18
%36 = load i32, i32* %8
%37 = add i32 %36, 1
store i32 %37, i32* %8
br label %15
38: ; preds = %15
%39 = load i8, i8* %9
%40 = load i8*, i8** %4
%41 = load i32, i32* %7
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 %39, i8* %43
br label %44
44: ; preds = %38
%45 = load i32, i32* %7
%46 = add i32 %45, 1
store i32 %46, i32* %7
br label %10
47: ; preds = %10
ret void
}

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