#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 */

/* Variables and functions */
float expand_element(unsigned char);
int /*<<< orphan*/ init_compand();
void expand_vector(float *r, unsigned char *x, int n) {
  int i;
  init_compand();
  for (i = 0; i < n; i++) {
    r[i] = expand_element(x[i]);
  }
}


x86 assembly (clang, -O0):
<expand_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <init_compand@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1179 <expand_vector+0x59>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1040 <expand_element@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <expand_vector+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_vector>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <init_compand@plt>
test   %ebp,%ebp
jle    1159 <expand_vector+0x39>
mov    %ebp,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%edi
call   1040 <expand_element@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <expand_vector+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @expand_vector(float* %0, i8* %1, i32 %2) {
%4 = alloca float*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store float* %0, float** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = call i32 (...) @init_compand()
store i32 0, i32* %7
br label %9
9: ; preds = %24, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call float @expand_element(i8 zeroext %18)
%20 = load float*, float** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %20, i64 %22
store float %19, float* %23
br label %24
24: ; preds = %13
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %9
27: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @expand_vector(float* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 (...) @init_compand()
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = tail call float @expand_element(i8 zeroext %11)
%13 = getelementptr inbounds float, float* %0, i64 %9
store float %12, float* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %3
ret void
}