#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 */
void decode_four_codes(uint8_t *out, const uint8_t *src) {
  out[0] = (src[0] << 2) | (src[1] >> 4);
  out[1] = (src[1] << 4) | (src[2] >> 2);
  out[2] = (src[2] << 6) | src[3];
}


x86 assembly (clang, -O0):
<decode_four_codes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x4,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
shl    $0x4,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
sar    $0x2,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
shl    $0x6,%ecx
mov    -0x10(%rbp),%rax
or     0xc(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_four_codes>:
mov    (%rsi),%eax
mov    0x4(%rsi),%ecx
shl    $0x2,%eax
sar    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,(%rdi)
mov    0x4(%rsi),%eax
mov    0x8(%rsi),%ecx
shl    $0x4,%eax
sar    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,0x4(%rdi)
mov    0x8(%rsi),%eax
shl    $0x6,%eax
or     0xc(%rsi),%eax
mov    %eax,0x8(%rdi)
ret

LLVM IR (-O0):
define void @decode_four_codes(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = shl i32 %7, 2
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = ashr i32 %11, 4
%13 = or i32 %8, %12
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 0
store i32 %13, i32* %15
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* %17
%19 = shl i32 %18, 4
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = load i32, i32* %21
%23 = ashr i32 %22, 2
%24 = or i32 %19, %23
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i64 1
store i32 %24, i32* %26
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 2
%29 = load i32, i32* %28
%30 = shl i32 %29, 6
%31 = load i32*, i32** %4
%32 = getelementptr inbounds i32, i32* %31, i64 3
%33 = load i32, i32* %32
%34 = or i32 %30, %33
%35 = load i32*, i32** %3
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 %34, i32* %36
ret void
}

LLVM IR (-O2):
define void @decode_four_codes(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 2
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = load i32, i32* %5
%7 = ashr i32 %6, 4
%8 = or i32 %7, %4
store i32 %8, i32* %0
%9 = load i32, i32* %5
%10 = shl i32 %9, 4
%11 = getelementptr inbounds i32, i32* %1, i64 2
%12 = load i32, i32* %11
%13 = ashr i32 %12, 2
%14 = or i32 %13, %10
%15 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %14, i32* %15
%16 = load i32, i32* %11
%17 = shl i32 %16, 6
%18 = getelementptr inbounds i32, i32* %1, i64 3
%19 = load i32, i32* %18
%20 = or i32 %17, %19
%21 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %20, i32* %21
ret void
}