#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 */
void glmSign3f(float out[3], const float x[3]) {
  for (size_t i = 0; i < 3; ++i)
    out[i] = (x[i] > 0.0f) - (x[i] < 0.0f);
}


x86 assembly (clang, -O0):
<glmSign3f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x3,-0x18(%rbp)
jae    1176 <glmSign3f+0x76>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
xorps  %xmm0,%xmm0
ucomiss (%rcx,%rdx,4),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <glmSign3f+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmSign3f>:
movss  (%rsi),%xmm1
xorps  %xmm0,%xmm0
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
sub    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rsi),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
sub    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  %xmm1,0x4(%rdi)
movss  0x8(%rsi),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @glmSign3f(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca i64
store float* %0, float** %3
store float* %1, float** %4
store i64 0, i64* %5
br label %6
6: ; preds = %27, %2
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, 3
br i1 %8, label %9, label %30
9: ; preds = %6
%10 = load float*, float** %4
%11 = load i64, i64* %5
%12 = getelementptr inbounds float, float* %10, i64 %11
%13 = load float, float* %12
%14 = fcmp ogt float %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = load float*, float** %4
%17 = load i64, i64* %5
%18 = getelementptr inbounds float, float* %16, i64 %17
%19 = load float, float* %18
%20 = fcmp olt float %19, 0.000000e+00
%21 = zext i1 %20 to i32
%22 = sub nsw i32 %15, %21
%23 = sitofp i32 %22 to float
%24 = load float*, float** %3
%25 = load i64, i64* %5
%26 = getelementptr inbounds float, float* %24, i64 %25
store float %23, float* %26
br label %27
27: ; preds = %9
%28 = load i64, i64* %5
%29 = add i64 %28, 1
store i64 %29, i64* %5
br label %6
30: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @glmSign3f(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = fcmp ogt float %3, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = fcmp olt float %3, 0.000000e+00
%7 = sext i1 %6 to i32
%8 = add nsw i32 %7, %5
%9 = sitofp i32 %8 to float
store float %9, float* %0
%10 = getelementptr inbounds float, float* %1, i64 1
%11 = load float, float* %10
%12 = fcmp ogt float %11, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = fcmp olt float %11, 0.000000e+00
%15 = sext i1 %14 to i32
%16 = add nsw i32 %15, %13
%17 = sitofp i32 %16 to float
%18 = getelementptr inbounds float, float* %0, i64 1
store float %17, float* %18
%19 = getelementptr inbounds float, float* %1, i64 2
%20 = load float, float* %19
%21 = fcmp ogt float %20, 0.000000e+00
%22 = zext i1 %21 to i32
%23 = fcmp olt float %20, 0.000000e+00
%24 = sext i1 %23 to i32
%25 = add nsw i32 %24, %22
%26 = sitofp i32 %25 to float
%27 = getelementptr inbounds float, float* %0, i64 2
store float %26, float* %27
ret void
}