#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 cos(float);
float sin(float);
void rotation_3d(float *x, float *y, float *z, float alpha, float beta,
                 float gamma) {
  float nx, ny;
  float cosga = cos(gamma), singa = sin(gamma), cosal = cos(alpha),
        sinal = sin(alpha);
  nx = cosga * *x - singa * *y;
  ny = cosal * (singa * *x + cosga * *y) - sinal * *z;
  *z = sinal * (singa * *x + cosga * *y) + cosal * *z;
  *x = nx;
  *y = ny;
}


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

x86 assembly (clang, -O2):
<rotation_3d>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm2,(%rsp)
movss  %xmm0,0x4(%rsp)
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movaps %xmm2,%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x8(%rsp)
movss  (%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0xc(%rsp)
movss  0x4(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
movss  (%rbx),%xmm1
movss  (%r14),%xmm2
movss  0x8(%rsp),%xmm4
movaps %xmm4,%xmm3
mulss  %xmm2,%xmm4
movaps %xmm4,%xmm5
movss  0xc(%rsp),%xmm4
mulss  %xmm4,%xmm2
mulss  %xmm1,%xmm3
subss  %xmm2,%xmm3
mulss  %xmm1,%xmm4
addss  %xmm5,%xmm4
movss  (%r15),%xmm1
movss  (%rsp),%xmm5
movaps %xmm5,%xmm2
mulss  %xmm1,%xmm5
mulss  %xmm0,%xmm1
mulss  %xmm4,%xmm2
subss  %xmm1,%xmm2
mulss  %xmm0,%xmm4
addss  %xmm5,%xmm4
movss  %xmm4,(%r15)
movss  %xmm3,(%rbx)
movss  %xmm2,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @rotation_3d(float* %0, float* %1, float* %2, float %3, float %4, float %5) {
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store float* %0, float** %7
store float* %1, float** %8
store float* %2, float** %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%19 = load float, float* %12
%20 = call float @cos(float %19)
store float %20, float* %15
%21 = load float, float* %12
%22 = call float @sin(float %21)
store float %22, float* %16
%23 = load float, float* %10
%24 = call float @cos(float %23)
store float %24, float* %17
%25 = load float, float* %10
%26 = call float @sin(float %25)
store float %26, float* %18
%27 = load float, float* %15
%28 = load float*, float** %7
%29 = load float, float* %28
%30 = load float, float* %16
%31 = load float*, float** %8
%32 = load float, float* %31
%33 = fmul float %30, %32
%34 = fneg float %33
%35 = call float @llvm.fmuladd.f32(float %27, float %29, float %34)
store float %35, float* %13
%36 = load float, float* %17
%37 = load float, float* %16
%38 = load float*, float** %7
%39 = load float, float* %38
%40 = load float, float* %15
%41 = load float*, float** %8
%42 = load float, float* %41
%43 = fmul float %40, %42
%44 = call float @llvm.fmuladd.f32(float %37, float %39, float %43)
%45 = load float, float* %18
%46 = load float*, float** %9
%47 = load float, float* %46
%48 = fmul float %45, %47
%49 = fneg float %48
%50 = call float @llvm.fmuladd.f32(float %36, float %44, float %49)
store float %50, float* %14
%51 = load float, float* %18
%52 = load float, float* %16
%53 = load float*, float** %7
%54 = load float, float* %53
%55 = load float, float* %15
%56 = load float*, float** %8
%57 = load float, float* %56
%58 = fmul float %55, %57
%59 = call float @llvm.fmuladd.f32(float %52, float %54, float %58)
%60 = load float, float* %17
%61 = load float*, float** %9
%62 = load float, float* %61
%63 = fmul float %60, %62
%64 = call float @llvm.fmuladd.f32(float %51, float %59, float %63)
%65 = load float*, float** %9
store float %64, float* %65
%66 = load float, float* %13
%67 = load float*, float** %7
store float %66, float* %67
%68 = load float, float* %14
%69 = load float*, float** %8
store float %68, float* %69
ret void
}

LLVM IR (-O2):
define void @rotation_3d(float* nocapture %0, float* nocapture %1, float* nocapture %2, float %3, float %4, float %5) {
%7 = tail call float @cos(float %5)
%8 = tail call float @sin(float %5)
%9 = tail call float @cos(float %3)
%10 = tail call float @sin(float %3)
%11 = load float, float* %0
%12 = load float, float* %1
%13 = fneg float %8
%14 = fmul float %12, %13
%15 = tail call float @llvm.fmuladd.f32(float %7, float %11, float %14)
%16 = fmul float %7, %12
%17 = tail call float @llvm.fmuladd.f32(float %8, float %11, float %16)
%18 = load float, float* %2
%19 = fneg float %10
%20 = fmul float %18, %19
%21 = tail call float @llvm.fmuladd.f32(float %9, float %17, float %20)
%22 = fmul float %9, %18
%23 = tail call float @llvm.fmuladd.f32(float %10, float %17, float %22)
store float %23, float* %2
store float %15, float* %0
store float %21, float* %1
ret void
}