#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 cos(double);
double sin(double);
int /*<<< orphan*/ vektorprodukt(double *, double *, double *);
void turn(double feld1[], double feld2[], double winkel) {
  double temp[3];
  double s, ca, sa, sx1, sx2, sx3;
  vektorprodukt(feld1, feld2, temp);
  s = feld1[0] * feld2[0] + feld1[1] * feld2[1] + feld1[2] * feld2[2];
  sx1 = s * feld2[0];
  sx2 = s * feld2[1];
  sx3 = s * feld2[2];
  sa = sin(winkel);
  ca = cos(winkel);
  feld1[0] = ca * (feld1[0] - sx1) + sa * temp[0] + sx1;
  feld1[1] = ca * (feld1[1] - sx2) + sa * temp[1] + sx2;
  feld1[2] = ca * (feld1[2] - sx3) + sa * temp[2] + sx3;
}


x86 assembly (clang, -O0):
<turn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <vektorprodukt@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
subsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
subsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
subsd  -0x60(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x30(%rsp),%rdx
call   1030 <vektorprodukt@plt>
movupd (%r14),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
mulsd  0x8(%rbx),%xmm1
movsd  (%rbx),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%r14),%xmm1
movsd  0x10(%rbx),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
unpcklpd %xmm3,%xmm3
mulpd  %xmm0,%xmm3
movapd %xmm3,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movupd (%rbx),%xmm1
movapd 0x20(%rsp),%xmm5
subpd  %xmm5,%xmm1
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm2
unpcklpd %xmm4,%xmm2
mulpd  0x30(%rsp),%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
addpd  %xmm2,%xmm3
addpd  %xmm5,%xmm3
movupd %xmm3,(%rbx)
movsd  0x10(%rbx),%xmm1
movsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm1
movapd %xmm4,%xmm3
mulsd  0x40(%rsp),%xmm3
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rbx)
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @turn(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca [3 x double]
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%14 = load double*, double** %4
%15 = load double*, double** %5
%16 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%17 = call i32 @vektorprodukt(double* %14, double* %15, double* %16)
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fmul double %26, %29
%31 = call double @llvm.fmuladd.f64(double %20, double %23, double %30)
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = call double @llvm.fmuladd.f64(double %34, double %37, double %31)
store double %38, double* %8
%39 = load double, double* %8
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = fmul double %39, %42
store double %43, double* %11
%44 = load double, double* %8
%45 = load double*, double** %5
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
%48 = fmul double %44, %47
store double %48, double* %12
%49 = load double, double* %8
%50 = load double*, double** %5
%51 = getelementptr inbounds double, double* %50, i64 2
%52 = load double, double* %51
%53 = fmul double %49, %52
store double %53, double* %13
%54 = load double, double* %6
%55 = call double @sin(double %54)
store double %55, double* %10
%56 = load double, double* %6
%57 = call double @cos(double %56)
store double %57, double* %9
%58 = load double, double* %9
%59 = load double*, double** %4
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = load double, double* %11
%63 = fsub double %61, %62
%64 = load double, double* %10
%65 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%66 = load double, double* %65
%67 = fmul double %64, %66
%68 = call double @llvm.fmuladd.f64(double %58, double %63, double %67)
%69 = load double, double* %11
%70 = fadd double %68, %69
%71 = load double*, double** %4
%72 = getelementptr inbounds double, double* %71, i64 0
store double %70, double* %72
%73 = load double, double* %9
%74 = load double*, double** %4
%75 = getelementptr inbounds double, double* %74, i64 1
%76 = load double, double* %75
%77 = load double, double* %12
%78 = fsub double %76, %77
%79 = load double, double* %10
%80 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%81 = load double, double* %80
%82 = fmul double %79, %81
%83 = call double @llvm.fmuladd.f64(double %73, double %78, double %82)
%84 = load double, double* %12
%85 = fadd double %83, %84
%86 = load double*, double** %4
%87 = getelementptr inbounds double, double* %86, i64 1
store double %85, double* %87
%88 = load double, double* %9
%89 = load double*, double** %4
%90 = getelementptr inbounds double, double* %89, i64 2
%91 = load double, double* %90
%92 = load double, double* %13
%93 = fsub double %91, %92
%94 = load double, double* %10
%95 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%96 = load double, double* %95
%97 = fmul double %94, %96
%98 = call double @llvm.fmuladd.f64(double %88, double %93, double %97)
%99 = load double, double* %13
%100 = fadd double %98, %99
%101 = load double*, double** %4
%102 = getelementptr inbounds double, double* %101, i64 2
store double %100, double* %102
ret void
}

LLVM IR (-O2):
define void @turn(double* %0, double* %1, double %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%7 = call i32 @vektorprodukt(double* %0, double* %1, double* %6)
%8 = load double, double* %0
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = bitcast double* %1 to <2 x double>*
%12 = load <2 x double>, <2 x double>* %11
%13 = extractelement <2 x double> %12, i64 1
%14 = fmul double %10, %13
%15 = extractelement <2 x double> %12, i64 0
%16 = call double @llvm.fmuladd.f64(double %8, double %15, double %14)
%17 = getelementptr inbounds double, double* %0, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = call double @llvm.fmuladd.f64(double %18, double %20, double %16)
%22 = insertelement <2 x double> poison, double %21, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = fmul <2 x double> %12, %23
%25 = fmul double %20, %21
%26 = call double @sin(double %2)
%27 = call double @cos(double %2)
%28 = bitcast double* %0 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = fsub <2 x double> %29, %24
%31 = bitcast [3 x double]* %4 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = insertelement <2 x double> poison, double %26, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = fmul <2 x double> %34, %32
%36 = insertelement <2 x double> poison, double %27, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %37, <2 x double> %30, <2 x double> %35)
%39 = fadd <2 x double> %24, %38
%40 = bitcast double* %0 to <2 x double>*
store <2 x double> %39, <2 x double>* %40
%41 = load double, double* %17
%42 = fsub double %41, %25
%43 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%44 = load double, double* %43
%45 = fmul double %26, %44
%46 = call double @llvm.fmuladd.f64(double %27, double %42, double %45)
%47 = fadd double %25, %46
store double %47, double* %17
ret void
}