int *freq_8_from_input(unsigned char one_byte) {
  static int a[8];
  for (int i = 0; i < 8; ++i) {
    a[i] = 400 + (unsigned char)((one_byte >> (7 - i)) & 0x1) * 400;
  }
  return a;
}


x86 assembly (clang, -O0):
<freq_8_from_input>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1157 <freq_8_from_input+0x57>
movzbl -0x1(%rbp),%eax
mov    $0x7,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
movzbl %al,%eax
imul   $0x190,%eax,%edx
add    $0x190,%edx
movslq -0x8(%rbp),%rcx
lea    0x2eea(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <freq_8_from_input+0x11>
lea    0x2ed2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<freq_8_from_input>:
mov    %edi,%eax
shr    $0x7,%eax
imul   $0x190,%eax,%eax
add    $0x190,%eax
mov    %eax,0x2f1a(%rip)
lea    0x2f13(%rip),%rax
mov    %edi,%ecx
shr    $0x6,%ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2efd(%rip)
mov    %edi,%ecx
shr    $0x5,%ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2ee7(%rip)
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2ed1(%rip)
mov    %edi,%ecx
shr    $0x3,%ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2ebb(%rip)
mov    %edi,%ecx
shr    $0x2,%ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2ea5(%rip)
mov    %edi,%ecx
shr    %ecx
and    $0x1,%ecx
imul   $0x190,%ecx,%ecx
add    $0x190,%ecx
mov    %ecx,0x2e90(%rip)
and    $0x1,%edi
imul   $0x190,%edi,%ecx
add    $0x190,%ecx
mov    %ecx,0x2e7f(%rip)
ret

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

LLVM IR (-O2):
@freq_8_from_input.a = internal global [8 x i32] zeroinitializer
define i32* @freq_8_from_input(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = lshr i32 %2, 7
%4 = mul nuw nsw i32 %3, 400
%5 = add nuw nsw i32 %4, 400
store i32 %5, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 0)
%6 = lshr i32 %2, 6
%7 = and i32 %6, 1
%8 = mul nuw nsw i32 %7, 400
%9 = add nuw nsw i32 %8, 400
store i32 %9, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 1)
%10 = lshr i32 %2, 5
%11 = and i32 %10, 1
%12 = mul nuw nsw i32 %11, 400
%13 = add nuw nsw i32 %12, 400
store i32 %13, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 2)
%14 = lshr i32 %2, 4
%15 = and i32 %14, 1
%16 = mul nuw nsw i32 %15, 400
%17 = add nuw nsw i32 %16, 400
store i32 %17, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 3)
%18 = lshr i32 %2, 3
%19 = and i32 %18, 1
%20 = mul nuw nsw i32 %19, 400
%21 = add nuw nsw i32 %20, 400
store i32 %21, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 4)
%22 = lshr i32 %2, 2
%23 = and i32 %22, 1
%24 = mul nuw nsw i32 %23, 400
%25 = add nuw nsw i32 %24, 400
store i32 %25, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 5)
%26 = lshr i32 %2, 1
%27 = and i32 %26, 1
%28 = mul nuw nsw i32 %27, 400
%29 = add nuw nsw i32 %28, 400
store i32 %29, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 6)
%30 = and i32 %2, 1
%31 = mul nuw nsw i32 %30, 400
%32 = add nuw nsw i32 %31, 400
store i32 %32, i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 7)
ret i32* getelementptr inbounds ([8 x i32], [8 x i32]* @freq_8_from_input.a, i64 0, i64 0)
}