#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 */
int /*<<< orphan*/ r3cpsc(double *, double *, double);
int /*<<< orphan*/ r3scal(double *, double);
int /*<<< orphan*/ r3x(double *, double *, double *);
double sqrt(double);
void new_xy_axis(int i, double *xx1, double *xx2, double x[3], double y[3],
                 double z[3]) {
  r3cpsc(x, z, -z[i]);
  x[i] += 1.0;
  double s2 = 1.0 / (1.0 - z[i] * z[i]);
  double s1 = sqrt(s2);
  r3scal(x, s1);
  r3x(y, z, x);
  *xx1 = s1;
  *xx2 = s2;
  return;
}


x86 assembly (clang, -O0):
<new_xy_axis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <r3cpsc@plt>
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  0xe60(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe19(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
call   1050 <r3scal@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <r3x@plt>
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_xy_axis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
movslq %edi,%rbp
movsd  (%r9,%rbp,8),%xmm0
xorps  0xe93(%rip),%xmm0
mov    %rcx,%rdi
mov    %r9,%rsi
call   1030 <r3cpsc@plt>
movsd  0xe90(%rip),%xmm0
movsd  (%rbx,%rbp,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rbp,8)
movsd  (%r12,%rbp,8),%xmm2
mulsd  %xmm2,%xmm2
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
jb     11ba <new_xy_axis+0x7a>
sqrtsd %xmm0,%xmm0
jmp    11bf <new_xy_axis+0x7f>
call   1060 <sqrt@plt>
mov    %rbx,%rdi
movsd  %xmm0,0x8(%rsp)
call   1050 <r3scal@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <r3x@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @new_xy_axis(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
store i32 %0, i32* %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%15 = load double*, double** %10
%16 = load double*, double** %12
%17 = load double*, double** %12
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fneg double %21
%23 = call i32 @r3cpsc(double* %15, double* %16, double %22)
%24 = load double*, double** %10
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = fadd double %28, 1.000000e+00
store double %29, double* %27
%30 = load double*, double** %12
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %12
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = fneg double %34
%41 = call double @llvm.fmuladd.f64(double %40, double %39, double 1.000000e+00)
%42 = fdiv double 1.000000e+00, %41
store double %42, double* %13
%43 = load double, double* %13
%44 = call double @sqrt(double %43)
store double %44, double* %14
%45 = load double*, double** %10
%46 = load double, double* %14
%47 = call i32 @r3scal(double* %45, double %46)
%48 = load double*, double** %11
%49 = load double*, double** %12
%50 = load double*, double** %10
%51 = call i32 @r3x(double* %48, double* %49, double* %50)
%52 = load double, double* %14
%53 = load double*, double** %8
store double %52, double* %53
%54 = load double, double* %13
%55 = load double*, double** %9
store double %54, double* %55
ret void
}

LLVM IR (-O2):
define void @new_xy_axis(i32 %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double* %3, double* %4, double* %5) {
%7 = sext i32 %0 to i64
%8 = getelementptr inbounds double, double* %5, i64 %7
%9 = load double, double* %8
%10 = fneg double %9
%11 = tail call i32 @r3cpsc(double* %3, double* %5, double %10)
%12 = getelementptr inbounds double, double* %3, i64 %7
%13 = load double, double* %12
%14 = fadd double %13, 1.000000e+00
store double %14, double* %12
%15 = load double, double* %8
%16 = fneg double %15
%17 = tail call double @llvm.fmuladd.f64(double %16, double %15, double 1.000000e+00)
%18 = fdiv double 1.000000e+00, %17
%19 = tail call double @sqrt(double %18)
%20 = tail call i32 @r3scal(double* %3, double %19)
%21 = tail call i32 @r3x(double* %4, double* %5, double* %3)
store double %19, double* %1
store double %18, double* %2
ret void
}