#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 orient2d(double *, double *, double *);
void normvec3i(double *vertex, int v1, int v2, int v3, double *v) {
  double w1[4], w2[4], w3[4];
  w1[0] = vertex[3 * v1 + 0], w2[0] = vertex[3 * v2 + 0],
  w3[0] = vertex[3 * v3 + 0];
  w1[1] = vertex[3 * v1 + 1], w2[1] = vertex[3 * v2 + 1],
  w3[1] = vertex[3 * v3 + 1];
  w1[2] = vertex[3 * v1 + 2], w2[2] = vertex[3 * v2 + 2],
  w3[2] = vertex[3 * v3 + 2];
  w1[3] = vertex[3 * v1 + 0], w2[3] = vertex[3 * v2 + 0],
  w3[3] = vertex[3 * v3 + 0];
  v[0] = orient2d(w3 + 1, w2 + 1, w1 + 1);
  v[1] = orient2d(w3 + 2, w2 + 2, w1 + 2);
  v[2] = orient2d(w3 + 0, w2 + 0, w1 + 0);
}


x86 assembly (clang, -O0):
<normvec3i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    -0x80(%rbp),%rdi
add    $0x8,%rdi
lea    -0x60(%rbp),%rsi
add    $0x8,%rsi
lea    -0x40(%rbp),%rdx
add    $0x8,%rdx
call   1030 <orient2d@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
lea    -0x80(%rbp),%rdi
add    $0x10,%rdi
lea    -0x60(%rbp),%rsi
add    $0x10,%rsi
lea    -0x40(%rbp),%rdx
add    $0x10,%rdx
call   1030 <orient2d@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
lea    -0x80(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <orient2d@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normvec3i>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %r8,%r13
lea    (%rsi,%rsi,2),%eax
cltq
lea    (%rdx,%rdx,2),%edx
movslq %edx,%rbx
movsd  (%rdi,%rbx,8),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    (%rcx,%rcx,2),%ecx
movslq %ecx,%rcx
movsd  (%rdi,%rcx,8),%xmm1
movsd  %xmm1,(%rsp)
movups (%rdi,%rax,8),%xmm2
lea    0x48(%rsp),%rdx
movaps %xmm2,0x40(%rsp)
movsd  0x8(%rdi,%rbx,8),%xmm3
lea    0x28(%rsp),%rsi
movsd  %xmm3,0x28(%rsp)
movsd  0x8(%rdi,%rcx,8),%xmm3
lea    0x8(%rsp),%r8
movsd  %xmm3,0x8(%rsp)
movsd  0x10(%rdi,%rax,8),%xmm3
lea    0x50(%rsp),%r14
movsd  %xmm3,0x50(%rsp)
movsd  0x10(%rdi,%rbx,8),%xmm3
lea    0x30(%rsp),%r15
movsd  %xmm3,0x30(%rsp)
movsd  0x10(%rdi,%rcx,8),%xmm3
lea    0x10(%rsp),%r12
movsd  %xmm3,0x10(%rsp)
movlps %xmm2,0x58(%rsp)
movsd  %xmm0,0x38(%rsp)
movsd  %xmm1,0x18(%rsp)
mov    %r8,%rdi
call   1030 <orient2d@plt>
movsd  %xmm0,0x0(%r13)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <orient2d@plt>
movsd  %xmm0,0x8(%r13)
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
lea    0x40(%rsp),%rdx
call   1030 <orient2d@plt>
movsd  %xmm0,0x10(%r13)
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @normvec3i(double* %0, i32 %1, i32 %2, i32 %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca [4 x double]
%12 = alloca [4 x double]
%13 = alloca [4 x double]
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double* %4, double** %10
%14 = load double*, double** %6
%15 = load i32, i32* %7
%16 = mul nsw i32 3, %15
%17 = add nsw i32 %16, 0
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %14, i64 %18
%20 = load double, double* %19
%21 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
store double %20, double* %21
%22 = load double*, double** %6
%23 = load i32, i32* %8
%24 = mul nsw i32 3, %23
%25 = add nsw i32 %24, 0
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %22, i64 %26
%28 = load double, double* %27
%29 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
store double %28, double* %29
%30 = load double*, double** %6
%31 = load i32, i32* %9
%32 = mul nsw i32 3, %31
%33 = add nsw i32 %32, 0
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %30, i64 %34
%36 = load double, double* %35
%37 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
store double %36, double* %37
%38 = load double*, double** %6
%39 = load i32, i32* %7
%40 = mul nsw i32 3, %39
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %38, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 1
store double %44, double* %45
%46 = load double*, double** %6
%47 = load i32, i32* %8
%48 = mul nsw i32 3, %47
%49 = add nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %46, i64 %50
%52 = load double, double* %51
%53 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 1
store double %52, double* %53
%54 = load double*, double** %6
%55 = load i32, i32* %9
%56 = mul nsw i32 3, %55
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %54, i64 %58
%60 = load double, double* %59
%61 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 1
store double %60, double* %61
%62 = load double*, double** %6
%63 = load i32, i32* %7
%64 = mul nsw i32 3, %63
%65 = add nsw i32 %64, 2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %62, i64 %66
%68 = load double, double* %67
%69 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 2
store double %68, double* %69
%70 = load double*, double** %6
%71 = load i32, i32* %8
%72 = mul nsw i32 3, %71
%73 = add nsw i32 %72, 2
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %70, i64 %74
%76 = load double, double* %75
%77 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 2
store double %76, double* %77
%78 = load double*, double** %6
%79 = load i32, i32* %9
%80 = mul nsw i32 3, %79
%81 = add nsw i32 %80, 2
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %78, i64 %82
%84 = load double, double* %83
%85 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 2
store double %84, double* %85
%86 = load double*, double** %6
%87 = load i32, i32* %7
%88 = mul nsw i32 3, %87
%89 = add nsw i32 %88, 0
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %86, i64 %90
%92 = load double, double* %91
%93 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 3
store double %92, double* %93
%94 = load double*, double** %6
%95 = load i32, i32* %8
%96 = mul nsw i32 3, %95
%97 = add nsw i32 %96, 0
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %94, i64 %98
%100 = load double, double* %99
%101 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 3
store double %100, double* %101
%102 = load double*, double** %6
%103 = load i32, i32* %9
%104 = mul nsw i32 3, %103
%105 = add nsw i32 %104, 0
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %102, i64 %106
%108 = load double, double* %107
%109 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 3
store double %108, double* %109
%110 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%113 = getelementptr inbounds double, double* %112, i64 1
%114 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%115 = getelementptr inbounds double, double* %114, i64 1
%116 = call double @orient2d(double* %111, double* %113, double* %115)
%117 = load double*, double** %10
%118 = getelementptr inbounds double, double* %117, i64 0
store double %116, double* %118
%119 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%120 = getelementptr inbounds double, double* %119, i64 2
%121 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%122 = getelementptr inbounds double, double* %121, i64 2
%123 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%124 = getelementptr inbounds double, double* %123, i64 2
%125 = call double @orient2d(double* %120, double* %122, double* %124)
%126 = load double*, double** %10
%127 = getelementptr inbounds double, double* %126, i64 1
store double %125, double* %127
%128 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%129 = getelementptr inbounds double, double* %128, i64 0
%130 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%131 = getelementptr inbounds double, double* %130, i64 0
%132 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%133 = getelementptr inbounds double, double* %132, i64 0
%134 = call double @orient2d(double* %129, double* %131, double* %133)
%135 = load double*, double** %10
%136 = getelementptr inbounds double, double* %135, i64 2
store double %134, double* %136
ret void
}

LLVM IR (-O2):
define void @normvec3i(double* nocapture %0, i32 %1, i32 %2, i32 %3, double* nocapture writeonly %4) {
%6 = alloca [4 x double]
%7 = alloca [4 x double]
%8 = alloca [4 x double]
%9 = bitcast [4 x double]* %6 to i8*
%10 = bitcast [4 x double]* %7 to i8*
%11 = bitcast [4 x double]* %8 to i8*
%12 = mul nsw i32 %1, 3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%16 = mul nsw i32 %2, 3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
store double %19, double* %20
%21 = mul nsw i32 %3, 3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = load double, double* %23
%25 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
store double %24, double* %25
%26 = bitcast double* %14 to <2 x double>*
%27 = load <2 x double>, <2 x double>* %26
%28 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 1
%29 = bitcast [4 x double]* %6 to <2 x double>*
store <2 x double> %27, <2 x double>* %29
%30 = add nsw i32 %16, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %0, i64 %31
%33 = load double, double* %32
%34 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 1
store double %33, double* %34
%35 = add nsw i32 %21, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = load double, double* %37
%39 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 1
store double %38, double* %39
%40 = add nsw i32 %12, 2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %0, i64 %41
%43 = load double, double* %42
%44 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 2
store double %43, double* %44
%45 = add nsw i32 %16, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %0, i64 %46
%48 = load double, double* %47
%49 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 2
store double %48, double* %49
%50 = add nsw i32 %21, 2
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %0, i64 %51
%53 = load double, double* %52
%54 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 2
store double %53, double* %54
%55 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 3
%56 = extractelement <2 x double> %27, i64 0
store double %56, double* %55
%57 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 3
store double %19, double* %57
%58 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 3
store double %24, double* %58
%59 = call double @orient2d(double* %39, double* %34, double* %28)
store double %59, double* %4
%60 = call double @orient2d(double* %54, double* %49, double* %44)
%61 = getelementptr inbounds double, double* %4, i64 1
store double %60, double* %61
%62 = call double @orient2d(double* %25, double* %20, double* %15)
%63 = getelementptr inbounds double, double* %4, i64 2
store double %62, double* %63
ret void
}