#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 orient3d(double *, double *, double *, double *);
double det3i4(double *vertex, int v1, int v2, int v3, int v4) {
  double r;
  r = orient3d(vertex + 3 * v1, vertex + 3 * v2, vertex + 3 * v3,
               vertex + 3 * v4);
  return r;
}


x86 assembly (clang, -O0):
<det3i4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
imul   $0x3,-0xc(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
imul   $0x3,-0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x8(%rbp),%rdx
imul   $0x3,-0x14(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x8(%rbp),%rcx
imul   $0x3,-0x18(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
call   1030 <orient3d@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<det3i4>:
lea    (%rsi,%rsi,2),%eax
cltq
lea    (%rdi,%rax,8),%rax
lea    (%rdx,%rdx,2),%edx
movslq %edx,%rdx
lea    (%rdi,%rdx,8),%rsi
lea    (%rcx,%rcx,2),%ecx
movslq %ecx,%rcx
lea    (%rdi,%rcx,8),%rdx
lea    (%r8,%r8,2),%ecx
movslq %ecx,%rcx
lea    (%rdi,%rcx,8),%rcx
mov    %rax,%rdi
jmp    1030 <orient3d@plt>

LLVM IR (-O0):
define double @det3i4(double* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load double*, double** %6
%13 = load i32, i32* %7
%14 = mul nsw i32 3, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %12, i64 %15
%17 = load double*, double** %6
%18 = load i32, i32* %8
%19 = mul nsw i32 3, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %17, i64 %20
%22 = load double*, double** %6
%23 = load i32, i32* %9
%24 = mul nsw i32 3, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %22, i64 %25
%27 = load double*, double** %6
%28 = load i32, i32* %10
%29 = mul nsw i32 3, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %27, i64 %30
%32 = call double @orient3d(double* %16, double* %21, double* %26, double* %31)
store double %32, double* %11
%33 = load double, double* %11
ret double %33
}

LLVM IR (-O2):
define double @det3i4(double* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = mul nsw i32 %1, 3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = mul nsw i32 %2, 3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = mul nsw i32 %3, 3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = mul nsw i32 %4, 3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %0, i64 %16
%18 = tail call double @orient3d(double* %8, double* %11, double* %14, double* %17)
ret double %18
}