#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);
double sin(double);
void point_neg(double *cur_point, double *next_point, double theta, double thi,
               double p_len) {
  next_point[0] = p_len * cos(theta + M_PI) * sin(thi) + cur_point[0];
  next_point[1] = p_len * sin(theta + M_PI) * sin(thi) + cur_point[1];
  next_point[2] = p_len * cos(thi) + cur_point[2];
}


x86 assembly (clang, -O0):
<point_neg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2e93(%rip),%rax
addsd  (%rax),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2e39(%rip),%rax
addsd  (%rax),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_neg>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e9d(%rip),%r15
movsd  (%r15),%xmm0
addsd  %xmm1,%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%r14)
movsd  (%rsp),%xmm0
addsd  (%r15),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x10(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @point_neg(double* %0, double* %1, double %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %10
%12 = load double, double* %8
%13 = load double, double* @M_PI
%14 = fadd double %12, %13
%15 = call double @cos(double %14)
%16 = fmul double %11, %15
%17 = load double, double* %9
%18 = call double @sin(double %17)
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = call double @llvm.fmuladd.f64(double %16, double %18, double %21)
%23 = load double*, double** %7
%24 = getelementptr inbounds double, double* %23, i64 0
store double %22, double* %24
%25 = load double, double* %10
%26 = load double, double* %8
%27 = load double, double* @M_PI
%28 = fadd double %26, %27
%29 = call double @sin(double %28)
%30 = fmul double %25, %29
%31 = load double, double* %9
%32 = call double @sin(double %31)
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %30, double %32, double %35)
%37 = load double*, double** %7
%38 = getelementptr inbounds double, double* %37, i64 1
store double %36, double* %38
%39 = load double, double* %10
%40 = load double, double* %9
%41 = call double @cos(double %40)
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 2
%44 = load double, double* %43
%45 = call double @llvm.fmuladd.f64(double %39, double %41, double %44)
%46 = load double*, double** %7
%47 = getelementptr inbounds double, double* %46, i64 2
store double %45, double* %47
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @point_neg(double* nocapture %0, double* nocapture writeonly %1, double %2, double %3, double %4) {
%6 = load double, double* @M_PI
%7 = fadd double %6, %2
%8 = tail call double @cos(double %7)
%9 = fmul double %8, %4
%10 = tail call double @sin(double %3)
%11 = load double, double* %0
%12 = tail call double @llvm.fmuladd.f64(double %9, double %10, double %11)
store double %12, double* %1
%13 = load double, double* @M_PI
%14 = fadd double %13, %2
%15 = tail call double @sin(double %14)
%16 = fmul double %15, %4
%17 = tail call double @sin(double %3)
%18 = getelementptr inbounds double, double* %0, i64 1
%19 = load double, double* %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %19)
%21 = getelementptr inbounds double, double* %1, i64 1
store double %20, double* %21
%22 = tail call double @cos(double %3)
%23 = getelementptr inbounds double, double* %0, i64 2
%24 = load double, double* %23
%25 = tail call double @llvm.fmuladd.f64(double %4, double %22, double %24)
%26 = getelementptr inbounds double, double* %1, i64 2
store double %25, double* %26
ret void
}