#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 */
typedef int uint8_t;

/* Variables and functions */
size_t fread(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(int *, int, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  static uint8_t inbuf[8192 * 4];
  static uint8_t outbuf[8192];
  size_t n;
  while ((n = fread(inbuf, 4, 8192, stdin))) {
    uint8_t *p = inbuf;
    for (size_t i = 0; i < n; i++) {
      uint8_t pack = 0;
      for (int j = 0; j < 4; j++) {
        pack <<= 2;
        pack |= ((*p) & 0x80) >> 6;
        pack |= ((*p) & 0x10) >> 4;
        p++;
      }
      outbuf[i] = pack;
    }
    fwrite(outbuf, 1, n, stdout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%ecx
lea    0x2f01(%rip),%rdi
mov    $0x4,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1223 <main+0x103>
lea    0x2edd(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1200 <main+0xe0>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    11de <main+0xbe>
mov    -0x24(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
and    $0x80,%eax
sar    $0x6,%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
and    $0x10,%eax
sar    $0x4,%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    118b <main+0x6b>
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0x22e54(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    116f <main+0x4f>
mov    -0x10(%rbp),%rdx
mov    0x2dcd(%rip),%rax
mov    (%rax),%ecx
lea    0x22e2c(%rip),%rdi
mov    $0x1,%esi
call   1040 <fwrite@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2eb8(%rip),%r15
mov    (%r15),%ecx
lea    0x2f06(%rip),%r13
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
test   %rax,%rax
je     136a <main+0x24a>
lea    0x22ee4(%rip),%r14
mov    0x2e75(%rip),%r12
movdqa 0xe94(%rip),%xmm8
movdqa 0xe9c(%rip),%xmm7
jmp    11c3 <main+0xa3>
cs nopw 0x0(%rax,%rax,1)
mov    (%r12),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
call   1040 <fwrite@plt>
mov    (%r15),%ecx
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
test   %rax,%rax
movdqa 0xe4b(%rip),%xmm8
movdqa 0xe53(%rip),%xmm7
je     136a <main+0x24a>
cmp    $0x4,%rax
jae    11e0 <main+0xc0>
xor    %edx,%edx
mov    %r13,%rcx
jmp    12e9 <main+0x1c9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdx
and    $0xfffffffffffffffc,%rdx
mov    %rdx,%rcx
shl    $0x4,%rcx
add    %r13,%rcx
mov    %rdx,%rsi
mov    %r14,%rdi
mov    %r13,%rbx
nopw   0x0(%rax,%rax,1)
movdqa (%rbx),%xmm0
movdqa 0x10(%rbx),%xmm1
movdqa 0x20(%rbx),%xmm4
movdqa 0x30(%rbx),%xmm5
movdqa %xmm4,%xmm6
punpckldq %xmm5,%xmm6
movdqa %xmm0,%xmm2
punpckldq %xmm1,%xmm2
movdqa %xmm2,%xmm3
punpcklqdq %xmm6,%xmm3
punpckhqdq %xmm6,%xmm2
punpckhdq %xmm5,%xmm4
punpckhdq %xmm1,%xmm0
movdqa %xmm0,%xmm1
punpcklqdq %xmm4,%xmm1
punpckhqdq %xmm4,%xmm0
movdqa %xmm3,%xmm4
psrld  $0x6,%xmm4
pand   %xmm8,%xmm4
psrld  $0x4,%xmm3
pand   %xmm7,%xmm3
por    %xmm4,%xmm3
pslld  $0x2,%xmm3
movdqa %xmm2,%xmm4
psrld  $0x6,%xmm4
pand   %xmm8,%xmm4
psrld  $0x4,%xmm2
pand   %xmm7,%xmm2
por    %xmm4,%xmm2
por    %xmm3,%xmm2
pslld  $0x2,%xmm2
movdqa %xmm1,%xmm3
psrld  $0x6,%xmm3
pand   %xmm8,%xmm3
psrld  $0x4,%xmm1
pand   %xmm7,%xmm1
por    %xmm3,%xmm1
por    %xmm2,%xmm1
pslld  $0x2,%xmm1
movdqa %xmm0,%xmm2
psrld  $0x6,%xmm2
pand   %xmm8,%xmm2
psrld  $0x4,%xmm0
pand   %xmm7,%xmm0
por    %xmm2,%xmm0
por    %xmm1,%xmm0
movdqa %xmm0,(%rdi)
add    $0x40,%rbx
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1200 <main+0xe0>
cmp    %rdx,%rax
je     1180 <main+0x60>
mov    %rax,%r9
sub    %rdx,%r9
lea    (%r14,%rdx,4),%r8
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rcx),%edx
mov    0x4(%rcx),%ebx
mov    %edx,%esi
shr    $0x6,%esi
and    $0x2,%esi
shr    $0x4,%edx
and    $0x1,%edx
or     %esi,%edx
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x2,%esi
lea    (%rsi,%rdx,4),%edx
shr    $0x4,%ebx
and    $0x1,%ebx
or     %edx,%ebx
mov    0x8(%rcx),%edx
mov    %edx,%esi
shr    $0x6,%esi
and    $0x2,%esi
lea    (%rsi,%rbx,4),%esi
shr    $0x4,%edx
and    $0x1,%edx
or     %esi,%edx
mov    0xc(%rcx),%esi
mov    %esi,%ebx
shr    $0x6,%ebx
and    $0x2,%ebx
lea    (%rbx,%rdx,4),%edx
shr    $0x4,%esi
and    $0x1,%esi
or     %edx,%esi
mov    %esi,(%r8,%rdi,4)
add    $0x1,%rdi
add    $0x10,%rcx
cmp    %rdi,%r9
jne    1300 <main+0x1e0>
jmp    1180 <main+0x60>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.inbuf = internal global [32768 x i32] zeroinitializer
@main.outbuf = internal global [8192 x i32] zeroinitializer
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %47, %0
%8 = load i32, i32* @stdin
%9 = call i64 @fread(i32* getelementptr inbounds ([32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 0), i32 4, i32 8192, i32 %8)
store i64 %9, i64* %2
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %51
11: ; preds = %7
store i32* getelementptr inbounds ([32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 0), i32** %3
store i64 0, i64* %4
br label %12
12: ; preds = %44, %11
%13 = load i64, i64* %4
%14 = load i64, i64* %2
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %47
16: ; preds = %12
store i32 0, i32* %5
store i32 0, i32* %6
br label %17
17: ; preds = %37, %16
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %40
20: ; preds = %17
%21 = load i32, i32* %5
%22 = shl i32 %21, 2
store i32 %22, i32* %5
%23 = load i32*, i32** %3
%24 = load i32, i32* %23
%25 = and i32 %24, 128
%26 = ashr i32 %25, 6
%27 = load i32, i32* %5
%28 = or i32 %27, %26
store i32 %28, i32* %5
%29 = load i32*, i32** %3
%30 = load i32, i32* %29
%31 = and i32 %30, 16
%32 = ashr i32 %31, 4
%33 = load i32, i32* %5
%34 = or i32 %33, %32
store i32 %34, i32* %5
%35 = load i32*, i32** %3
%36 = getelementptr inbounds i32, i32* %35, i32 1
store i32* %36, i32** %3
br label %37
37: ; preds = %20
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %17
40: ; preds = %17
%41 = load i32, i32* %5
%42 = load i64, i64* %4
%43 = getelementptr inbounds [8192 x i32], [8192 x i32]* @main.outbuf, i64 0, i64 %42
store i32 %41, i32* %43
br label %44
44: ; preds = %40
%45 = load i64, i64* %4
%46 = add i64 %45, 1
store i64 %46, i64* %4
br label %12
47: ; preds = %12
%48 = load i64, i64* %2
%49 = load i32, i32* @stdout
%50 = call i32 @fwrite(i32* getelementptr inbounds ([8192 x i32], [8192 x i32]* @main.outbuf, i64 0, i64 0), i32 1, i64 %48, i32 %49)
br label %7
51: ; preds = %7
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@main.inbuf = internal global [32768 x i32] zeroinitializer
@main.outbuf = internal global [8192 x i32] zeroinitializer
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i64 @fread(i32* getelementptr inbounds ([32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 0), i32 4, i32 8192, i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %102, label %4
4: ; preds = %0, %96
%5 = phi i64 [ %100, %96 ], [ %2, %0 ]
%6 = icmp ult i64 %5, 4
br i1 %6, label %53, label %7
7: ; preds = %4
%8 = and i64 %5, -4
%9 = shl i64 %8, 2
%10 = getelementptr [32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 %9
br label %11
11: ; preds = %11, %7
%12 = phi i64 [ 0, %7 ], [ %49, %11 ]
%13 = shl i64 %12, 2
%14 = getelementptr [32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 %13
%15 = bitcast i32* %14 to <16 x i32>*
%16 = load <16 x i32>, <16 x i32>* %15
%17 = shufflevector <16 x i32> %16, <16 x i32> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
%18 = shufflevector <16 x i32> %16, <16 x i32> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
%19 = shufflevector <16 x i32> %16, <16 x i32> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
%20 = shufflevector <16 x i32> %16, <16 x i32> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
%21 = lshr <4 x i32> %17, <i32 6, i32 6, i32 6, i32 6>
%22 = and <4 x i32> %21, <i32 2, i32 2, i32 2, i32 2>
%23 = lshr <4 x i32> %17, <i32 4, i32 4, i32 4, i32 4>
%24 = and <4 x i32> %23, <i32 1, i32 1, i32 1, i32 1>
%25 = or <4 x i32> %22, %24
%26 = shl nuw nsw <4 x i32> %25, <i32 2, i32 2, i32 2, i32 2>
%27 = lshr <4 x i32> %18, <i32 6, i32 6, i32 6, i32 6>
%28 = and <4 x i32> %27, <i32 2, i32 2, i32 2, i32 2>
%29 = or <4 x i32> %28, %26
%30 = lshr <4 x i32> %18, <i32 4, i32 4, i32 4, i32 4>
%31 = and <4 x i32> %30, <i32 1, i32 1, i32 1, i32 1>
%32 = or <4 x i32> %29, %31
%33 = shl nuw nsw <4 x i32> %32, <i32 2, i32 2, i32 2, i32 2>
%34 = lshr <4 x i32> %19, <i32 6, i32 6, i32 6, i32 6>
%35 = and <4 x i32> %34, <i32 2, i32 2, i32 2, i32 2>
%36 = or <4 x i32> %35, %33
%37 = lshr <4 x i32> %19, <i32 4, i32 4, i32 4, i32 4>
%38 = and <4 x i32> %37, <i32 1, i32 1, i32 1, i32 1>
%39 = or <4 x i32> %36, %38
%40 = shl <4 x i32> %39, <i32 2, i32 2, i32 2, i32 2>
%41 = lshr <4 x i32> %20, <i32 6, i32 6, i32 6, i32 6>
%42 = and <4 x i32> %41, <i32 2, i32 2, i32 2, i32 2>
%43 = or <4 x i32> %42, %40
%44 = lshr <4 x i32> %20, <i32 4, i32 4, i32 4, i32 4>
%45 = and <4 x i32> %44, <i32 1, i32 1, i32 1, i32 1>
%46 = or <4 x i32> %43, %45
%47 = getelementptr inbounds [8192 x i32], [8192 x i32]* @main.outbuf, i64 0, i64 %12
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %48
%49 = add nuw i64 %12, 4
%50 = icmp eq i64 %49, %8
br i1 %50, label %51, label %11
51: ; preds = %11
%52 = icmp eq i64 %5, %8
br i1 %52, label %96, label %53
53: ; preds = %4, %51
%54 = phi i64 [ 0, %4 ], [ %8, %51 ]
%55 = phi i32* [ getelementptr inbounds ([32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 0), %4 ], [ %10, %51 ]
br label %56
56: ; preds = %53, %56
%57 = phi i64 [ %94, %56 ], [ %54, %53 ]
%58 = phi i32* [ %92, %56 ], [ %55, %53 ]
%59 = load i32, i32* %58
%60 = lshr i32 %59, 6
%61 = and i32 %60, 2
%62 = lshr i32 %59, 4
%63 = and i32 %62, 1
%64 = or i32 %61, %63
%65 = getelementptr inbounds i32, i32* %58, i64 1
%66 = shl nuw nsw i32 %64, 2
%67 = load i32, i32* %65
%68 = lshr i32 %67, 6
%69 = and i32 %68, 2
%70 = or i32 %69, %66
%71 = lshr i32 %67, 4
%72 = and i32 %71, 1
%73 = or i32 %70, %72
%74 = getelementptr inbounds i32, i32* %58, i64 2
%75 = shl nuw nsw i32 %73, 2
%76 = load i32, i32* %74
%77 = lshr i32 %76, 6
%78 = and i32 %77, 2
%79 = or i32 %78, %75
%80 = lshr i32 %76, 4
%81 = and i32 %80, 1
%82 = or i32 %79, %81
%83 = getelementptr inbounds i32, i32* %58, i64 3
%84 = shl i32 %82, 2
%85 = load i32, i32* %83
%86 = lshr i32 %85, 6
%87 = and i32 %86, 2
%88 = or i32 %87, %84
%89 = lshr i32 %85, 4
%90 = and i32 %89, 1
%91 = or i32 %88, %90
%92 = getelementptr i32, i32* %58, i64 4
%93 = getelementptr inbounds [8192 x i32], [8192 x i32]* @main.outbuf, i64 0, i64 %57
store i32 %91, i32* %93
%94 = add nuw i64 %57, 1
%95 = icmp eq i64 %94, %5
br i1 %95, label %96, label %56
96: ; preds = %56, %51
%97 = load i32, i32* @stdout
%98 = tail call i32 @fwrite(i32* getelementptr inbounds ([8192 x i32], [8192 x i32]* @main.outbuf, i64 0, i64 0), i32 1, i64 %5, i32 %97)
%99 = load i32, i32* @stdin
%100 = tail call i64 @fread(i32* getelementptr inbounds ([32768 x i32], [32768 x i32]* @main.inbuf, i64 0, i64 0), i32 4, i32 8192, i32 %99)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %4
102: ; preds = %96, %0
ret i32 0
}