#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 */
unsigned char linear_sample_to_srgb(float);
int /*<<< orphan*/ shift_left_f(float *);
void yscale_out_linear(float *sums, int len, unsigned char *out) {
  int i;
  for (i = 0; i < len; i++) {
    out[i] = linear_sample_to_srgb(*sums);
    shift_left_f(sums);
    sums += 4;
  }
}


x86 assembly (clang, -O0):
<yscale_out_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1183 <yscale_out_linear+0x63>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <linear_sample_to_srgb@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <shift_left_f@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <yscale_out_linear+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yscale_out_linear>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1164 <yscale_out_linear+0x44>
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movss  (%r12),%xmm0
call   1030 <linear_sample_to_srgb@plt>
mov    %al,(%r14,%rbx,1)
mov    %r12,%rdi
call   1040 <shift_left_f@plt>
add    $0x10,%r12
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <yscale_out_linear+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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