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


x86 assembly (clang, -O0):
<glmMod3fv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jae    11ad <glmMod3fv+0x9d>
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
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
divss  (%rax,%rcx,4),%xmm0
call   1030 <floorf@plt>
movss  -0x24(%rbp),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%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    112c <glmMod3fv+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMod3fv>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
movss  (%rsi),%xmm0
movss  %xmm0,0xc(%rsp)
divss  (%rdx),%xmm0
call   1030 <floorf@plt>
mulss  (%rbx),%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%r14)
movss  0x4(%r15),%xmm0
movss  %xmm0,0xc(%rsp)
divss  0x4(%rbx),%xmm0
call   1030 <floorf@plt>
mulss  0x4(%rbx),%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x8(%r15),%xmm0
movss  %xmm0,0xc(%rsp)
divss  0x8(%rbx),%xmm0
call   1030 <floorf@plt>
mulss  0x8(%rbx),%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @glmMod3fv(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 = %35, %3
%9 = load i64, i64* %7
%10 = icmp ult i64 %9, 3
br i1 %10, label %11, label %38
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 = load i64, i64* %7
%22 = getelementptr inbounds float, float* %20, i64 %21
%23 = load float, float* %22
%24 = fdiv float %19, %23
%25 = call float @floorf(float %24)
%26 = load float*, float** %6
%27 = load i64, i64* %7
%28 = getelementptr inbounds float, float* %26, i64 %27
%29 = load float, float* %28
%30 = fneg float %25
%31 = call float @llvm.fmuladd.f32(float %30, float %29, float %15)
%32 = load float*, float** %4
%33 = load i64, i64* %7
%34 = getelementptr inbounds float, float* %32, i64 %33
store float %31, float* %34
br label %35
35: ; preds = %11
%36 = load i64, i64* %7
%37 = add i64 %36, 1
store i64 %37, i64* %7
br label %8
38: ; preds = %8
ret void
}

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