int *freq_4_from_input(unsigned char one_byte) {
  static int a[4];
  for (int i = 0; i < 4; ++i) {
    a[i] = 300 + (unsigned char)((one_byte >> (6 - (i * 2))) & 0x3) * 200;
  }
  return a;
}


x86 assembly (clang, -O0):
<freq_4_from_input>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    115c <freq_4_from_input+0x5c>
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%edx
shl    $0x1,%edx
mov    $0x6,%ecx
sub    %edx,%ecx
sar    %cl,%eax
and    $0x3,%eax
movzbl %al,%eax
imul   $0xc8,%eax,%edx
add    $0x12c,%edx
movslq -0x8(%rbp),%rcx
lea    0x2ee5(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <freq_4_from_input+0x11>
lea    0x2ecd(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<freq_4_from_input>:
mov    %edi,%eax
shr    $0x6,%eax
imul   $0xc8,%eax,%eax
add    $0x12c,%eax
mov    %eax,0x2f1a(%rip)
lea    0x2f13(%rip),%rax
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0x3,%ecx
imul   $0xc8,%ecx,%ecx
add    $0x12c,%ecx
mov    %ecx,0x2efd(%rip)
mov    %edi,%ecx
shr    $0x2,%ecx
and    $0x3,%ecx
imul   $0xc8,%ecx,%ecx
add    $0x12c,%ecx
mov    %ecx,0x2ee7(%rip)
and    $0x3,%edi
imul   $0xc8,%edi,%ecx
add    $0x12c,%ecx
mov    %ecx,0x2ed6(%rip)
ret

LLVM IR (-O0):
@freq_4_from_input.a = internal global [4 x i32] zeroinitializer
define i32* @freq_4_from_input(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
br label %4
4: ; preds = %22, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 2
%12 = sub nsw i32 6, %11
%13 = ashr i32 %9, %12
%14 = and i32 %13, 3
%15 = trunc i32 %14 to i8
%16 = zext i8 %15 to i32
%17 = mul nsw i32 %16, 200
%18 = add nsw i32 300, %17
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 %20
store i32 %18, i32* %21
br label %22
22: ; preds = %7
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %4
25: ; preds = %4
ret i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 0)
}

LLVM IR (-O2):
@freq_4_from_input.a = internal global [4 x i32] zeroinitializer
define i32* @freq_4_from_input(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = lshr i32 %2, 6
%4 = mul nuw nsw i32 %3, 200
%5 = add nuw nsw i32 %4, 300
store i32 %5, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 0)
%6 = lshr i32 %2, 4
%7 = and i32 %6, 3
%8 = mul nuw nsw i32 %7, 200
%9 = add nuw nsw i32 %8, 300
store i32 %9, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 1)
%10 = lshr i32 %2, 2
%11 = and i32 %10, 3
%12 = mul nuw nsw i32 %11, 200
%13 = add nuw nsw i32 %12, 300
store i32 %13, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 2)
%14 = and i32 %2, 3
%15 = mul nuw nsw i32 %14, 200
%16 = add nuw nsw i32 %15, 300
store i32 %16, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 3)
ret i32* getelementptr inbounds ([4 x i32], [4 x i32]* @freq_4_from_input.a, i64 0, i64 0)
}