#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*/ vcopy(double *, double *);
int /*<<< orphan*/ vnorm(double *);
void vcomplement(double v1[3], double v2[3]) {
  double c[2][3] = {{v1[2], v1[2], -v1[0] - v1[1]},
                    {-v1[1] - v1[2], v1[0], v1[0]}};
  int i = ((v1[2] != 0.0) && (-v1[0] != v1[1]));
  vcopy(c[i], v2);
  vnorm(v2);
}


x86 assembly (clang, -O0):
<vcomplement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x45(%rbp)
jne    11e7 <vcomplement+0xc7>
jp     11e7 <vcomplement+0xc7>
jmp    121a <vcomplement+0xfa>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x44(%rbp)
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x18,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <vcopy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <vnorm@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vcomplement>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x8(%rsp)
movupd (%rdi),%xmm1
movapd 0xebc(%rip),%xmm2
xorpd  %xmm1,%xmm2
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
movapd %xmm1,%xmm4
xorpd  %xmm5,%xmm5
ucomisd %xmm0,%xmm5
setp   %al
setne  %cl
or     %al,%cl
ucomisd %xmm2,%xmm3
shufpd $0x1,%xmm0,%xmm4
subpd  %xmm4,%xmm2
movapd %xmm2,0x10(%rsp)
unpcklpd %xmm1,%xmm1
movapd %xmm1,0x20(%rsp)
setp   %al
setne  %dl
or     %al,%dl
and    %cl,%dl
movzbl %dl,%eax
lea    (%rax,%rax,2),%rax
lea    (%rsp,%rax,8),%rdi
call   1040 <vcopy@plt>
mov    %rbx,%rdi
call   1030 <vnorm@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @vcomplement(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [2 x [3 x double]]
%6 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
%7 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %5, i64 0, i64 0
%8 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
store double %11, double* %8
%12 = getelementptr inbounds double, double* %8, i64 1
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 2
%15 = load double, double* %14
store double %15, double* %12
%16 = getelementptr inbounds double, double* %12, i64 1
%17 = load double*, double** %3
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = fneg double %19
%21 = load double*, double** %3
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = fsub double %20, %23
store double %24, double* %16
%25 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 1
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fneg double %29
%31 = load double*, double** %3
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = fsub double %30, %33
store double %34, double* %26
%35 = getelementptr inbounds double, double* %26, i64 1
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
store double %38, double* %35
%39 = getelementptr inbounds double, double* %35, i64 1
%40 = load double*, double** %3
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
store double %42, double* %39
%43 = load double*, double** %3
%44 = getelementptr inbounds double, double* %43, i64 2
%45 = load double, double* %44
%46 = fcmp une double %45, 0.000000e+00
br i1 %46, label %47, label %56
47: ; preds = %2
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = fneg double %50
%52 = load double*, double** %3
%53 = getelementptr inbounds double, double* %52, i64 1
%54 = load double, double* %53
%55 = fcmp une double %51, %54
br label %56
56: ; preds = %47, %2
%57 = phi i1 [ false, %2 ], [ %55, %47 ]
%58 = zext i1 %57 to i32
store i32 %58, i32* %6
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %5, i64 0, i64 %60
%62 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 0, i64 0
%63 = load double*, double** %4
%64 = call i32 @vcopy(double* %62, double* %63)
%65 = load double*, double** %4
%66 = call i32 @vnorm(double* %65)
ret void
}

LLVM IR (-O2):
define void @vcomplement(double* nocapture %0, double* %1) {
%3 = alloca [2 x [3 x double]]
%4 = bitcast [2 x [3 x double]]* %3 to i8*
%5 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 0, i64 0
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
store double %7, double* %5
%8 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 0, i64 1
store double %7, double* %8
%9 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 0, i64 2
%10 = bitcast double* %0 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = fneg <2 x double> %11
%13 = extractelement <2 x double> %11, i64 1
%14 = insertelement <2 x double> poison, double %13, i64 0
%15 = insertelement <2 x double> %14, double %7, i64 1
%16 = fsub <2 x double> %12, %15
%17 = bitcast double* %9 to <2 x double>*
store <2 x double> %16, <2 x double>* %17
%18 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 1, i64 1
%19 = extractelement <2 x double> %11, i64 0
store double %19, double* %18
%20 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 1, i64 2
store double %19, double* %20
%21 = fcmp une double %7, 0.000000e+00
%22 = extractelement <2 x double> %12, i64 0
%23 = fcmp une double %13, %22
%24 = select i1 %21, i1 %23, i1 false
%25 = zext i1 %24 to i64
%26 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 %25, i64 0
%27 = call i32 @vcopy(double* %26, double* %1)
%28 = call i32 @vnorm(double* %1)
ret void
}