#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 */
double M_PI;
double cos(double const);
double sin(double const);
double sqrt(double);
void scm_vector(long long f, double y, double x, double *v) {
  const double s = x * M_PI / 2.0 - M_PI / 4.0;
  const double t = y * M_PI / 2.0 - M_PI / 4.0;
  double u[3];
  u[0] = sin(s) * cos(t);
  u[1] = -cos(s) * sin(t);
  u[2] = cos(s) * cos(t);
  double k = 1.0 / sqrt(u[0] * u[0] + u[1] * u[1] + u[2] * u[2]);
  u[0] *= k;
  u[1] *= k;
  u[2] *= k;
  switch (f) {
  case 0:
    v[0] = u[2];
    v[1] = u[1];
    v[2] = -u[0];
    break;
  case 1:
    v[0] = -u[2];
    v[1] = u[1];
    v[2] = u[0];
    break;
  case 2:
    v[0] = u[0];
    v[1] = u[2];
    v[2] = -u[1];
    break;
  case 3:
    v[0] = u[0];
    v[1] = -u[2];
    v[2] = u[1];
    break;
  case 4:
    v[0] = u[0];
    v[1] = u[1];
    v[2] = u[2];
    break;
  case 5:
    v[0] = -u[0];
    v[1] = u[1];
    v[2] = -u[2];
    break;
  }
}


x86 assembly (clang, -O0):
<scm_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2e8f(%rip),%rax
movsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm3
divsd  %xmm3,%xmm0
movsd  0xe93(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
divsd  %xmm3,%xmm0
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movaps 0xe45(%rip),%xmm1
pxor   %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xdb4(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
sub    $0x5,%rax
ja     145d <scm_vector+0x32d>
mov    -0x60(%rbp),%rax
lea    0xd75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    145d <scm_vector+0x32d>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    145d <scm_vector+0x32d>
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    145d <scm_vector+0x32d>
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    145d <scm_vector+0x32d>
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    145d <scm_vector+0x32d>
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scm_vector>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
movapd %xmm1,%xmm4
mov    %rdi,%rbx
mov    0x2ea0(%rip),%rax
movsd  (%rax),%xmm3
mulsd  %xmm3,%xmm4
movsd  0xea8(%rip),%xmm1
mulsd  %xmm1,%xmm4
movsd  0xea4(%rip),%xmm2
mulsd  %xmm3,%xmm2
subsd  %xmm2,%xmm4
movsd  %xmm4,0x8(%rsp)
mulsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm4,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x30(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
xorps  0xe64(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x20(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm2
movapd %xmm0,%xmm4
mulsd  0x8(%rsp),%xmm4
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1243 <scm_vector+0x113>
sqrtsd %xmm0,%xmm0
cmp    $0x5,%rbx
jbe    126a <scm_vector+0x13a>
jmp    1320 <scm_vector+0x1f0>
movapd %xmm4,0x10(%rsp)
call   1050 <sqrt@plt>
movapd 0x10(%rsp),%xmm4
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm2
cmp    $0x5,%rbx
ja     1320 <scm_vector+0x1f0>
movsd  0xd9e(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm4
lea    0xda7(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movsd  %xmm4,(%r14)
movsd  %xmm3,0x8(%r14)
xorpd  0xd7b(%rip),%xmm2
jmp    131a <scm_vector+0x1ea>
xorpd  0xd71(%rip),%xmm4
movlpd %xmm4,(%r14)
movsd  %xmm3,0x8(%r14)
jmp    131a <scm_vector+0x1ea>
movsd  %xmm2,(%r14)
movsd  %xmm4,0x8(%r14)
xorpd  0xd51(%rip),%xmm3
movapd %xmm3,%xmm2
jmp    131a <scm_vector+0x1ea>
movsd  %xmm2,(%r14)
xorpd  0xd3e(%rip),%xmm4
movlpd %xmm4,0x8(%r14)
movapd %xmm3,%xmm2
jmp    131a <scm_vector+0x1ea>
movsd  %xmm2,(%r14)
movsd  %xmm3,0x8(%r14)
jmp    1316 <scm_vector+0x1e6>
movapd 0xd1d(%rip),%xmm0
xorpd  %xmm0,%xmm2
movlpd %xmm2,(%r14)
movsd  %xmm3,0x8(%r14)
xorpd  %xmm0,%xmm4
movapd %xmm4,%xmm2
movsd  %xmm2,0x10(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @scm_vector(i64 %0, double %1, double %2, double* %3) {
%5 = alloca i64
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca [3 x double]
%12 = alloca double
store i64 %0, i64* %5
store double %1, double* %6
store double %2, double* %7
store double* %3, double** %8
%13 = load double, double* %7
%14 = load double, double* @M_PI
%15 = fmul double %13, %14
%16 = fdiv double %15, 2.000000e+00
%17 = load double, double* @M_PI
%18 = fdiv double %17, 4.000000e+00
%19 = fsub double %16, %18
store double %19, double* %9
%20 = load double, double* %6
%21 = load double, double* @M_PI
%22 = fmul double %20, %21
%23 = fdiv double %22, 2.000000e+00
%24 = load double, double* @M_PI
%25 = fdiv double %24, 4.000000e+00
%26 = fsub double %23, %25
store double %26, double* %10
%27 = load double, double* %9
%28 = call double @sin(double %27)
%29 = load double, double* %10
%30 = call double @cos(double %29)
%31 = fmul double %28, %30
%32 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
store double %31, double* %32
%33 = load double, double* %9
%34 = call double @cos(double %33)
%35 = fneg double %34
%36 = load double, double* %10
%37 = call double @sin(double %36)
%38 = fmul double %35, %37
%39 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
store double %38, double* %39
%40 = load double, double* %9
%41 = call double @cos(double %40)
%42 = load double, double* %10
%43 = call double @cos(double %42)
%44 = fmul double %41, %43
%45 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
store double %44, double* %45
%46 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%47 = load double, double* %46
%48 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%49 = load double, double* %48
%50 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%51 = load double, double* %50
%52 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%53 = load double, double* %52
%54 = fmul double %51, %53
%55 = call double @llvm.fmuladd.f64(double %47, double %49, double %54)
%56 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%57 = load double, double* %56
%58 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%59 = load double, double* %58
%60 = call double @llvm.fmuladd.f64(double %57, double %59, double %55)
%61 = call double @sqrt(double %60)
%62 = fdiv double 1.000000e+00, %61
store double %62, double* %12
%63 = load double, double* %12
%64 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%65 = load double, double* %64
%66 = fmul double %65, %63
store double %66, double* %64
%67 = load double, double* %12
%68 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%69 = load double, double* %68
%70 = fmul double %69, %67
store double %70, double* %68
%71 = load double, double* %12
%72 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%73 = load double, double* %72
%74 = fmul double %73, %71
store double %74, double* %72
%75 = load i64, i64* %5
switch i64 %75, label %160 [
i64 0, label %76
i64 1, label %90
i64 2, label %104
i64 3, label %118
i64 4, label %132
i64 5, label %145
]
76: ; preds = %4
%77 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%78 = load double, double* %77
%79 = load double*, double** %8
%80 = getelementptr inbounds double, double* %79, i64 0
store double %78, double* %80
%81 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%82 = load double, double* %81
%83 = load double*, double** %8
%84 = getelementptr inbounds double, double* %83, i64 1
store double %82, double* %84
%85 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%86 = load double, double* %85
%87 = fneg double %86
%88 = load double*, double** %8
%89 = getelementptr inbounds double, double* %88, i64 2
store double %87, double* %89
br label %160
90: ; preds = %4
%91 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%92 = load double, double* %91
%93 = fneg double %92
%94 = load double*, double** %8
%95 = getelementptr inbounds double, double* %94, i64 0
store double %93, double* %95
%96 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%97 = load double, double* %96
%98 = load double*, double** %8
%99 = getelementptr inbounds double, double* %98, i64 1
store double %97, double* %99
%100 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%101 = load double, double* %100
%102 = load double*, double** %8
%103 = getelementptr inbounds double, double* %102, i64 2
store double %101, double* %103
br label %160
104: ; preds = %4
%105 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%106 = load double, double* %105
%107 = load double*, double** %8
%108 = getelementptr inbounds double, double* %107, i64 0
store double %106, double* %108
%109 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%110 = load double, double* %109
%111 = load double*, double** %8
%112 = getelementptr inbounds double, double* %111, i64 1
store double %110, double* %112
%113 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%114 = load double, double* %113
%115 = fneg double %114
%116 = load double*, double** %8
%117 = getelementptr inbounds double, double* %116, i64 2
store double %115, double* %117
br label %160
118: ; preds = %4
%119 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%120 = load double, double* %119
%121 = load double*, double** %8
%122 = getelementptr inbounds double, double* %121, i64 0
store double %120, double* %122
%123 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%124 = load double, double* %123
%125 = fneg double %124
%126 = load double*, double** %8
%127 = getelementptr inbounds double, double* %126, i64 1
store double %125, double* %127
%128 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%129 = load double, double* %128
%130 = load double*, double** %8
%131 = getelementptr inbounds double, double* %130, i64 2
store double %129, double* %131
br label %160
132: ; preds = %4
%133 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%134 = load double, double* %133
%135 = load double*, double** %8
%136 = getelementptr inbounds double, double* %135, i64 0
store double %134, double* %136
%137 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%138 = load double, double* %137
%139 = load double*, double** %8
%140 = getelementptr inbounds double, double* %139, i64 1
store double %138, double* %140
%141 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%142 = load double, double* %141
%143 = load double*, double** %8
%144 = getelementptr inbounds double, double* %143, i64 2
store double %142, double* %144
br label %160
145: ; preds = %4
%146 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%147 = load double, double* %146
%148 = fneg double %147
%149 = load double*, double** %8
%150 = getelementptr inbounds double, double* %149, i64 0
store double %148, double* %150
%151 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%152 = load double, double* %151
%153 = load double*, double** %8
%154 = getelementptr inbounds double, double* %153, i64 1
store double %152, double* %154
%155 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%156 = load double, double* %155
%157 = fneg double %156
%158 = load double*, double** %8
%159 = getelementptr inbounds double, double* %158, i64 2
store double %157, double* %159
br label %160
160: ; preds = %4, %145, %132, %118, %104, %90, %76
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @scm_vector(i64 %0, double %1, double %2, double* nocapture writeonly %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, %2
%7 = fmul double %6, 5.000000e-01
%8 = fmul double %5, 2.500000e-01
%9 = fsub double %7, %8
%10 = fmul double %5, %1
%11 = fmul double %10, 5.000000e-01
%12 = fsub double %11, %8
%13 = tail call double @sin(double %9)
%14 = tail call double @cos(double %12)
%15 = fmul double %13, %14
%16 = tail call double @cos(double %9)
%17 = fneg double %16
%18 = tail call double @sin(double %12)
%19 = fmul double %18, %17
%20 = tail call double @cos(double %9)
%21 = tail call double @cos(double %12)
%22 = fmul double %20, %21
%23 = fmul double %19, %19
%24 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %23)
%25 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %24)
%26 = tail call double @sqrt(double %25)
%27 = fdiv double 1.000000e+00, %26
%28 = fmul double %15, %27
%29 = fmul double %19, %27
%30 = fmul double %22, %27
switch i64 %0, label %52 [
i64 0, label %31
i64 1, label %34
i64 2, label %37
i64 3, label %40
i64 4, label %43
i64 5, label %45
]
31: ; preds = %4
store double %30, double* %3
%32 = getelementptr inbounds double, double* %3, i64 1
store double %29, double* %32
%33 = fneg double %28
br label %49
34: ; preds = %4
%35 = fneg double %30
store double %35, double* %3
%36 = getelementptr inbounds double, double* %3, i64 1
store double %29, double* %36
br label %49
37: ; preds = %4
store double %28, double* %3
%38 = getelementptr inbounds double, double* %3, i64 1
store double %30, double* %38
%39 = fneg double %29
br label %49
40: ; preds = %4
store double %28, double* %3
%41 = fneg double %30
%42 = getelementptr inbounds double, double* %3, i64 1
store double %41, double* %42
br label %49
43: ; preds = %4
store double %28, double* %3
%44 = getelementptr inbounds double, double* %3, i64 1
store double %29, double* %44
br label %49
45: ; preds = %4
%46 = fneg double %28
store double %46, double* %3
%47 = getelementptr inbounds double, double* %3, i64 1
store double %29, double* %47
%48 = fneg double %30
br label %49
49: ; preds = %31, %34, %37, %40, %43, %45
%50 = phi double [ %48, %45 ], [ %30, %43 ], [ %29, %40 ], [ %39, %37 ], [ %28, %34 ], [ %33, %31 ]
%51 = getelementptr inbounds double, double* %3, i64 2
store double %50, double* %51
br label %52
52: ; preds = %49, %4
ret void
}