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


x86 assembly (clang, -O0):
<glmMod3fs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jae    119e <glmMod3fs+0x8e>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
divss  -0x14(%rbp),%xmm0
call   1030 <floorf@plt>
movss  -0x24(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112d <glmMod3fs+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMod3fs>:
push   %r14
push   %rbx
push   %rax
movaps %xmm0,%xmm1
movss  %xmm0,0x4(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r14
movss  (%rsi),%xmm0
movss  %xmm0,(%rsp)
divss  %xmm1,%xmm0
call   1030 <floorf@plt>
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  (%rsp),%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,(%r14)
movss  0x4(%rbx),%xmm0
movss  %xmm0,(%rsp)
divss  %xmm1,%xmm0
call   1030 <floorf@plt>
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  (%rsp),%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,0x4(%r14)
movss  0x8(%rbx),%xmm0
movss  %xmm0,(%rsp)
divss  %xmm1,%xmm0
call   1030 <floorf@plt>
mulss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @glmMod3fs(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca i64
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
store i64 0, i64* %7
br label %8
8: ; preds = %29, %3
%9 = load i64, i64* %7
%10 = icmp ult i64 %9, 3
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = load float*, float** %5
%13 = load i64, i64* %7
%14 = getelementptr inbounds float, float* %12, i64 %13
%15 = load float, float* %14
%16 = load float*, float** %5
%17 = load i64, i64* %7
%18 = getelementptr inbounds float, float* %16, i64 %17
%19 = load float, float* %18
%20 = load float, float* %6
%21 = fdiv float %19, %20
%22 = call float @llvm.floor.f32(float %21)
%23 = load float, float* %6
%24 = fneg float %22
%25 = call float @llvm.fmuladd.f32(float %24, float %23, float %15)
%26 = load float*, float** %4
%27 = load i64, i64* %7
%28 = getelementptr inbounds float, float* %26, i64 %27
store float %25, float* %28
br label %29
29: ; preds = %11
%30 = load i64, i64* %7
%31 = add i64 %30, 1
store i64 %31, i64* %7
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @glmMod3fs(float* nocapture writeonly %0, float* nocapture %1, float %2) {
%4 = load float, float* %1
%5 = fdiv float %4, %2
%6 = tail call float @llvm.floor.f32(float %5)
%7 = fneg float %6
%8 = tail call float @llvm.fmuladd.f32(float %7, float %2, float %4)
store float %8, float* %0
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fdiv float %10, %2
%12 = tail call float @llvm.floor.f32(float %11)
%13 = fneg float %12
%14 = tail call float @llvm.fmuladd.f32(float %13, float %2, float %10)
%15 = getelementptr inbounds float, float* %0, i64 1
store float %14, float* %15
%16 = getelementptr inbounds float, float* %1, i64 2
%17 = load float, float* %16
%18 = fdiv float %17, %2
%19 = tail call float @llvm.floor.f32(float %18)
%20 = fneg float %19
%21 = tail call float @llvm.fmuladd.f32(float %20, float %2, float %17)
%22 = getelementptr inbounds float, float* %0, i64 2
store float %21, float* %22
ret void
}