#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 cellVolume_(double **, int **, int **, int *, int *);
double computeCellVolume(double xv[8][3], int nvert) {
  double vol;
  int itype;
  int nfaces;
  int numverts[4][6] = {3, 3, 3, 3, 0, 0, 4, 3, 3, 3, 3, 0,
                        3, 4, 4, 4, 3, 0, 4, 4, 4, 4, 4, 4};
  int faceInfo[4][24] = {
      1, 2, 3, 0, 1, 4, 2, 0, 2, 4, 3, 0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      1, 2, 3, 4, 1, 5, 2, 0, 2, 5, 3, 0, 4, 3, 5, 0, 1, 4, 5, 0, 0, 0, 0, 0,
      1, 2, 3, 0, 1, 4, 5, 2, 2, 5, 6, 3, 1, 3, 6, 4, 4, 6, 5, 0, 0, 0, 0, 0,
      1, 2, 3, 4, 1, 5, 6, 2, 2, 6, 7, 3, 3, 7, 8, 4, 1, 4, 8, 5, 5, 8, 7, 6};
  switch (nvert) {
  case 4:
    itype = 0;
    nfaces = 4;
    break;
  case 5:
    itype = 1;
    nfaces = 5;
    break;
  case 6:
    itype = 2;
    nfaces = 5;
    break;
  case 8:
    itype = 3;
    nfaces = 6;
    break;
  }
  vol = cellVolume_(xv, &numverts[itype], &faceInfo[itype], &nfaces, &nvert);
  return vol;
}


x86 assembly (clang, -O0):
<computeCellVolume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movaps 0xf37(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movaps 0xf1c(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
lea    0xf05(%rip),%rsi
lea    -0x200(%rbp),%rdi
mov    $0x180,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x208(%rbp)
sub    $0x4,%eax
ja     1202 <computeCellVolume+0xe2>
mov    -0x208(%rbp),%rax
lea    0xe4e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x1c(%rbp)
movl   $0x4,-0x20(%rbp)
jmp    1202 <computeCellVolume+0xe2>
movl   $0x1,-0x1c(%rbp)
movl   $0x5,-0x20(%rbp)
jmp    1202 <computeCellVolume+0xe2>
movl   $0x2,-0x1c(%rbp)
movl   $0x5,-0x20(%rbp)
jmp    1202 <computeCellVolume+0xe2>
movl   $0x3,-0x1c(%rbp)
movl   $0x6,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
lea    -0x80(%rbp),%rsi
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0x1c(%rbp),%rax
lea    -0x200(%rbp),%rdx
imul   $0x60,%rax,%rax
add    %rax,%rdx
lea    -0x20(%rbp),%rcx
lea    -0xc(%rbp),%r8
call   1030 <cellVolume_@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeCellVolume>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,0xc(%rsp)
movaps 0xf36(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf1a(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xefe(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xefe(%rip),%rsi
lea    0x70(%rsp),%rdi
mov    $0x180,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
add    $0xfffffffc,%ebx
cmp    $0x4,%ebx
ja     11e2 <computeCellVolume+0xc2>
lea    0xe5e(%rip),%rcx
movslq (%rcx,%rbx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
movl   $0x4,0x8(%rsp)
xor    %eax,%eax
jmp    11e2 <computeCellVolume+0xc2>
movl   $0x5,0x8(%rsp)
mov    $0x1,%eax
jmp    11e2 <computeCellVolume+0xc2>
movl   $0x5,0x8(%rsp)
mov    $0x2,%eax
jmp    11e2 <computeCellVolume+0xc2>
movl   $0x6,0x8(%rsp)
mov    $0x3,%eax
lea    (%rax,%rax,2),%rax
lea    (%rsp,%rax,8),%rsi
add    $0x10,%rsi
shl    $0x5,%rax
lea    (%rsp,%rax,1),%rdx
add    $0x70,%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %r14,%rdi
call   1030 <cellVolume_@plt>
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.computeCellVolume.numverts = [4 x [6 x i32]] [[6 x i32] [i32 3, i32 3, i32 3, i32 3, i32 0, i32 0], [6 x i32] [i32 4, i32 3, i32 3, i32 3, i32 3, i32 0], [6 x i32] [i32 3, i32 4, i32 4, i32 4, i32 3, i32 0], [6 x i32] [i32 4, i32 4, i32 4, i32 4, i32 4, i32 4]]
@__const.computeCellVolume.faceInfo = <{ <{ [15 x i32], [9 x i32] }>, [24 x i32], [24 x i32], [24 x i32] }> <{ <{ [15 x i32], [9 x i32] }> <{ [15 x i32] [i32 1, i32 2, i32 3, i32 0, i32 1, i32 4, i32 2, i32 0, i32 2, i32 4, i32 3, i32 0, i32 1, i32 3, i32 4], [9 x i32] zeroinitializer }>, [24 x i32] [i32 1, i32 2, i32 3, i32 4, i32 1, i32 5, i32 2, i32 0, i32 2, i32 5, i32 3, i32 0, i32 4, i32 3, i32 5, i32 0, i32 1, i32 4, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0], [24 x i32] [i32 1, i32 2, i32 3, i32 0, i32 1, i32 4, i32 5, i32 2, i32 2, i32 5, i32 6, i32 3, i32 1, i32 3, i32 6, i32 4, i32 4, i32 6, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0], [24 x i32] [i32 1, i32 2, i32 3, i32 4, i32 1, i32 5, i32 6, i32 2, i32 2, i32 6, i32 7, i32 3, i32 3, i32 7, i32 8, i32 4, i32 1, i32 4, i32 8, i32 5, i32 5, i32 8, i32 7, i32 6] }>
define double @computeCellVolume([3 x double]* %0, i32 %1) {
%3 = alloca [3 x double]*
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4 x [6 x i32]]
%9 = alloca [4 x [24 x i32]]
store [3 x double]* %0, [3 x double]** %3
store i32 %1, i32* %4
%10 = bitcast [4 x [6 x i32]]* %8 to i8*
%11 = bitcast [4 x [24 x i32]]* %9 to i8*
%12 = load i32, i32* %4
switch i32 %12, label %17 [
i32 4, label %13
i32 5, label %14
i32 6, label %15
i32 8, label %16
]
13: ; preds = %2
store i32 0, i32* %6
store i32 4, i32* %7
br label %17
14: ; preds = %2
store i32 1, i32* %6
store i32 5, i32* %7
br label %17
15: ; preds = %2
store i32 2, i32* %6
store i32 5, i32* %7
br label %17
16: ; preds = %2
store i32 3, i32* %6
store i32 6, i32* %7
br label %17
17: ; preds = %2, %16, %15, %14, %13
%18 = load [3 x double]*, [3 x double]** %3
%19 = bitcast [3 x double]* %18 to double**
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x [6 x i32]], [4 x [6 x i32]]* %8, i64 0, i64 %21
%23 = bitcast [6 x i32]* %22 to i32**
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4 x [24 x i32]], [4 x [24 x i32]]* %9, i64 0, i64 %25
%27 = bitcast [24 x i32]* %26 to i32**
%28 = call double @cellVolume_(double** %19, i32** %23, i32** %27, i32* %7, i32* %4)
store double %28, double* %5
%29 = load double, double* %5
ret double %29
}

LLVM IR (-O2):
@__const.computeCellVolume.numverts = [4 x [6 x i32]] [[6 x i32] [i32 3, i32 3, i32 3, i32 3, i32 0, i32 0], [6 x i32] [i32 4, i32 3, i32 3, i32 3, i32 3, i32 0], [6 x i32] [i32 3, i32 4, i32 4, i32 4, i32 3, i32 0], [6 x i32] [i32 4, i32 4, i32 4, i32 4, i32 4, i32 4]]
@__const.computeCellVolume.faceInfo = <{ <{ [15 x i32], [9 x i32] }>, [24 x i32], [24 x i32], [24 x i32] }> <{ <{ [15 x i32], [9 x i32] }> <{ [15 x i32] [i32 1, i32 2, i32 3, i32 0, i32 1, i32 4, i32 2, i32 0, i32 2, i32 4, i32 3, i32 0, i32 1, i32 3, i32 4], [9 x i32] zeroinitializer }>, [24 x i32] [i32 1, i32 2, i32 3, i32 4, i32 1, i32 5, i32 2, i32 0, i32 2, i32 5, i32 3, i32 0, i32 4, i32 3, i32 5, i32 0, i32 1, i32 4, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0], [24 x i32] [i32 1, i32 2, i32 3, i32 0, i32 1, i32 4, i32 5, i32 2, i32 2, i32 5, i32 6, i32 3, i32 1, i32 3, i32 6, i32 4, i32 4, i32 6, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0], [24 x i32] [i32 1, i32 2, i32 3, i32 4, i32 1, i32 5, i32 6, i32 2, i32 2, i32 6, i32 7, i32 3, i32 3, i32 7, i32 8, i32 4, i32 1, i32 4, i32 8, i32 5, i32 5, i32 8, i32 7, i32 6] }>
define double @computeCellVolume([3 x double]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x [6 x i32]]
%6 = alloca [4 x [24 x i32]]
store i32 %1, i32* %3
%7 = bitcast i32* %4 to i8*
%8 = bitcast [4 x [6 x i32]]* %5 to i8*
%9 = bitcast [4 x [24 x i32]]* %6 to i8*
switch i32 %1, label %14 [
i32 4, label %10
i32 5, label %11
i32 6, label %12
i32 8, label %13
]
10: ; preds = %2
store i32 4, i32* %4
br label %14
11: ; preds = %2
store i32 5, i32* %4
br label %14
12: ; preds = %2
store i32 5, i32* %4
br label %14
13: ; preds = %2
store i32 6, i32* %4
br label %14
14: ; preds = %2, %13, %12, %11, %10
%15 = phi i64 [ 0, %2 ], [ 3, %13 ], [ 2, %12 ], [ 1, %11 ], [ 0, %10 ]
%16 = bitcast [3 x double]* %0 to double**
%17 = getelementptr inbounds [4 x [6 x i32]], [4 x [6 x i32]]* %5, i64 0, i64 %15
%18 = bitcast [6 x i32]* %17 to i32**
%19 = getelementptr inbounds [4 x [24 x i32]], [4 x [24 x i32]]* %6, i64 0, i64 %15
%20 = bitcast [24 x i32]* %19 to i32**
%21 = call double @cellVolume_(double** %16, i32** %18, i32** %20, i32* %4, i32* %3)
ret double %21
}