#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 cosf(float);
float sinf(float);
void vec3_rotateX(float *dst, float *b, float c) {
  float p[3], r[3];
  p[0] = dst[0] - b[0];
  p[1] = dst[1] - b[1];
  p[2] = dst[2] - b[2];
  r[0] = p[0];
  r[1] = p[1] * cosf(c) - p[2] * sinf(c);
  r[2] = p[1] * sinf(c) + p[2] * cosf(c);
  dst[0] = r[0] + b[0];
  dst[1] = r[1] + b[1];
  dst[2] = r[2] + b[2];
}


x86 assembly (clang, -O0):
<vec3_rotateX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sinf@plt>
movss  -0x44(%rbp),%xmm1
movss  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x3c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x38(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x30(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x2c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_rotateX>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
subss  (%rsi),%xmm1
movss  %xmm1,0x14(%rsp)
subss  0x4(%rsi),%xmm2
movss  %xmm2,0xc(%rsp)
movss  %xmm0,0x4(%rsp)
movss  0x8(%rdi),%xmm1
subss  0x8(%rsi),%xmm1
movss  %xmm1,0x8(%rsp)
call   1040 <cosf@plt>
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0x8(%rsp),%xmm0
movss  (%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1040 <cosf@plt>
mulss  0x8(%rsp),%xmm0
movss  0x10(%rsp),%xmm2
mulss  0xc(%rsp),%xmm2
movss  0x14(%rsp),%xmm1
addss  (%r14),%xmm1
addss  %xmm0,%xmm2
movss  %xmm1,(%rbx)
movss  (%rsp),%xmm0
addss  0x4(%r14),%xmm0
movss  %xmm0,0x4(%rbx)
addss  0x8(%r14),%xmm2
movss  %xmm2,0x8(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @vec3_rotateX(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca [3 x float]
%8 = alloca [3 x float]
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %5
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = fsub float %11, %14
%16 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
store float %15, float* %16
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = load float*, float** %5
%21 = getelementptr inbounds float, float* %20, i64 1
%22 = load float, float* %21
%23 = fsub float %19, %22
%24 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
store float %23, float* %24
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %5
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = fsub float %27, %30
%32 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
store float %31, float* %32
%33 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%34 = load float, float* %33
%35 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float %34, float* %35
%36 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%37 = load float, float* %36
%38 = load float, float* %6
%39 = call float @cosf(float %38)
%40 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%41 = load float, float* %40
%42 = load float, float* %6
%43 = call float @sinf(float %42)
%44 = fmul float %41, %43
%45 = fneg float %44
%46 = call float @llvm.fmuladd.f32(float %37, float %39, float %45)
%47 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
store float %46, float* %47
%48 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%49 = load float, float* %48
%50 = load float, float* %6
%51 = call float @sinf(float %50)
%52 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%53 = load float, float* %52
%54 = load float, float* %6
%55 = call float @cosf(float %54)
%56 = fmul float %53, %55
%57 = call float @llvm.fmuladd.f32(float %49, float %51, float %56)
%58 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
store float %57, float* %58
%59 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%60 = load float, float* %59
%61 = load float*, float** %5
%62 = getelementptr inbounds float, float* %61, i64 0
%63 = load float, float* %62
%64 = fadd float %60, %63
%65 = load float*, float** %4
%66 = getelementptr inbounds float, float* %65, i64 0
store float %64, float* %66
%67 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
%68 = load float, float* %67
%69 = load float*, float** %5
%70 = getelementptr inbounds float, float* %69, i64 1
%71 = load float, float* %70
%72 = fadd float %68, %71
%73 = load float*, float** %4
%74 = getelementptr inbounds float, float* %73, i64 1
store float %72, float* %74
%75 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
%76 = load float, float* %75
%77 = load float*, float** %5
%78 = getelementptr inbounds float, float* %77, i64 2
%79 = load float, float* %78
%80 = fadd float %76, %79
%81 = load float*, float** %4
%82 = getelementptr inbounds float, float* %81, i64 2
store float %80, float* %82
ret void
}

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