void inertial1d(struct vtx_data **graph, int nvtxs, int cube_or_mesh, int nsets,
                float *x, int *sets, double *goal, int using_vwgts) {
  extern double median_time;
  double *value;
  double time;
  int *space;
  int i;
  void rec_median_1();
  double seconds();
  value = smalloc((nvtxs + 1) * sizeof(double));
  for (i = 1; i <= nvtxs; i++) {
    value[i] = x[i];
  }
  space = smalloc(nvtxs * sizeof(int));
  time = seconds();
  rec_median_1(graph, value, nvtxs, space, cube_or_mesh, nsets, goal,
               using_vwgts, sets, 1);
  median_time += seconds() - time;
  sfree(space);
  sfree(value);
}


x86 assembly (clang, -O0):
<inertial1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
mov    $0x0,%al
call   1060 <smalloc@plt>
cltq
mov    %rax,-0x30(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11bd <inertial1d+0x7d>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1185 <inertial1d+0x45>
movslq -0xc(%rbp),%rdi
shl    $0x2,%rdi
mov    $0x0,%al
call   1060 <smalloc@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <seconds@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    0x10(%rbp),%r11
mov    0x18(%rbp),%r10d
mov    -0x28(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
movl   $0x1,0x18(%rsp)
mov    $0x0,%al
call   1050 <rec_median_1@plt>
mov    $0x0,%al
call   1030 <seconds@plt>
subsd  -0x38(%rbp),%xmm0
mov    0x2db7(%rip),%rax
addsd  (%rax),%xmm0
mov    0x2dac(%rip),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1040 <sfree@plt>
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1040 <sfree@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inertial1d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,%r14
mov    %ecx,0x4(%rsp)
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%r13
mov    0x68(%rsp),%eax
mov    %rax,0x10(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x1(%r15),%ebp
movslq %ebp,%rdi
shl    $0x3,%rdi
xor    %eax,%eax
call   1060 <smalloc@plt>
movslq %eax,%rbx
test   %r15d,%r15d
jle    1258 <inertial1d+0x118>
mov    %ebp,%eax
lea    -0x1(%rax),%rdx
mov    $0x1,%ecx
cmp    $0x4,%rdx
jb     1240 <inertial1d+0x100>
mov    %rdx,%rcx
and    $0xfffffffffffffffc,%rcx
lea    -0x4(%rcx),%rsi
mov    %rsi,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     12e1 <inertial1d+0x1a1>
mov    %rbp,%rsi
and    $0xfffffffffffffffe,%rsi
mov    $0x1,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cvtps2pd (%r14,%rdi,4),%xmm0
cvtps2pd 0x8(%r14,%rdi,4),%xmm1
movups %xmm0,(%rbx,%rdi,8)
movups %xmm1,0x10(%rbx,%rdi,8)
cvtps2pd 0x10(%r14,%rdi,4),%xmm0
cvtps2pd 0x18(%r14,%rdi,4),%xmm1
movups %xmm0,0x20(%rbx,%rdi,8)
movups %xmm1,0x30(%rbx,%rdi,8)
add    $0x8,%rdi
add    $0xfffffffffffffffe,%rsi
jne    11e0 <inertial1d+0xa0>
test   $0x1,%bpl
je     122e <inertial1d+0xee>
cvtps2pd (%r14,%rdi,4),%xmm0
cvtps2pd 0x8(%r14,%rdi,4),%xmm1
movups %xmm0,(%rbx,%rdi,8)
movups %xmm1,0x10(%rbx,%rdi,8)
cmp    %rcx,%rdx
je     1258 <inertial1d+0x118>
or     $0x1,%rcx
nopw   0x0(%rax,%rax,1)
movss  (%r14,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1240 <inertial1d+0x100>
movslq %r15d,%rdi
shl    $0x2,%rdi
xor    %eax,%eax
call   1060 <smalloc@plt>
movslq %eax,%rbp
xor    %eax,%eax
call   1030 <seconds@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %rbp,%rcx
mov    %r12d,%r8d
mov    0x4(%rsp),%r9d
xor    %eax,%eax
push   $0x1
push   0x28(%rsp)
push   0x20(%rsp)
push   0x30(%rsp)
call   1050 <rec_median_1@plt>
add    $0x20,%rsp
xor    %eax,%eax
call   1030 <seconds@plt>
subsd  0x8(%rsp),%xmm0
mov    0x2d31(%rip),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <sfree@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <sfree@plt>
mov    $0x1,%edi
test   $0x1,%bpl
jne    121a <inertial1d+0xda>
jmp    122e <inertial1d+0xee>

LLVM IR (-O0):
%struct.vtx_data = type opaque
@median_time = external global double
define void @inertial1d(%struct.vtx_data** %0, i32 %1, i32 %2, i32 %3, float* %4, i32* %5, double* %6, i32 %7) {
%9 = alloca %struct.vtx_data**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float*
%14 = alloca i32*
%15 = alloca double*
%16 = alloca i32
%17 = alloca double*
%18 = alloca double
%19 = alloca i32*
%20 = alloca i32
store %struct.vtx_data** %0, %struct.vtx_data*** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store float* %4, float** %13
store i32* %5, i32** %14
store double* %6, double** %15
store i32 %7, i32* %16
%21 = load i32, i32* %10
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 8
%25 = call i32 (i64, ...) bitcast (i32 (...)* @smalloc to i32 (i64, ...)*)(i64 %24)
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to double*
store double* %27, double** %17
store i32 1, i32* %20
br label %28
28: ; preds = %43, %8
%29 = load i32, i32* %20
%30 = load i32, i32* %10
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %46
32: ; preds = %28
%33 = load float*, float** %13
%34 = load i32, i32* %20
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = load double*, double** %17
%40 = load i32, i32* %20
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %32
%44 = load i32, i32* %20
%45 = add nsw i32 %44, 1
store i32 %45, i32* %20
br label %28
46: ; preds = %28
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = mul i64 %48, 4
%50 = call i32 (i64, ...) bitcast (i32 (...)* @smalloc to i32 (i64, ...)*)(i64 %49)
%51 = sext i32 %50 to i64
%52 = inttoptr i64 %51 to i32*
store i32* %52, i32** %19
%53 = call double (...) @seconds()
store double %53, double* %18
%54 = load %struct.vtx_data**, %struct.vtx_data*** %9
%55 = load double*, double** %17
%56 = load i32, i32* %10
%57 = load i32*, i32** %19
%58 = load i32, i32* %11
%59 = load i32, i32* %12
%60 = load double*, double** %15
%61 = load i32, i32* %16
%62 = load i32*, i32** %14
%63 = call double (...) @seconds()
%64 = load double, double* %18
%65 = fsub double %63, %64
%66 = load double, double* @median_time
%67 = fadd double %66, %65
store double %67, double* @median_time
%68 = load i32*, i32** %19
%69 = call i32 (i32*, ...) bitcast (i32 (...)* @sfree to i32 (i32*, ...)*)(i32* %68)
%70 = load double*, double** %17
%71 = call i32 (double*, ...) bitcast (i32 (...)* @sfree to i32 (double*, ...)*)(double* %70)
ret void
}

LLVM IR (-O2):
%struct.vtx_data = type opaque
@median_time = external global double
define void @inertial1d(%struct.vtx_data** %0, i32 %1, i32 %2, i32 %3, float* nocapture %4, i32* %5, double* %6, i32 %7) {
%9 = add i32 %1, 1
%10 = sext i32 %9 to i64
%11 = shl nsw i64 %10, 3
%12 = tail call i32 (i64, ...) bitcast (i32 (...)* @smalloc to i32 (i64, ...)*)(i64 %11)
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to double*
%15 = icmp slt i32 %1, 1
br i1 %15, label %92, label %16
16: ; preds = %8
%17 = zext i32 %9 to i64
%18 = add nsw i64 %17, -1
%19 = icmp ult i64 %18, 4
br i1 %19, label %82, label %20
20: ; preds = %16
%21 = and i64 %18, -4
%22 = or i64 %21, 1
%23 = add nsw i64 %21, -4
%24 = lshr exact i64 %23, 2
%25 = add nuw nsw i64 %24, 1
%26 = and i64 %25, 1
%27 = icmp eq i64 %23, 0
br i1 %27, label %64, label %28
28: ; preds = %20
%29 = and i64 %25, 9223372036854775806
br label %30
30: ; preds = %30, %28
%31 = phi i64 [ 0, %28 ], [ %59, %30 ]
%32 = phi i64 [ 0, %28 ], [ %60, %30 ]
%33 = or i64 %31, 1
%34 = getelementptr inbounds float, float* %4, i64 %33
%35 = bitcast float* %34 to <2 x float>*
%36 = load <2 x float>, <2 x float>* %35
%37 = getelementptr inbounds float, float* %34, i64 2
%38 = bitcast float* %37 to <2 x float>*
%39 = load <2 x float>, <2 x float>* %38
%40 = fpext <2 x float> %36 to <2 x double>
%41 = fpext <2 x float> %39 to <2 x double>
%42 = getelementptr inbounds double, double* %14, i64 %33
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %40, <2 x double>* %43
%44 = getelementptr inbounds double, double* %42, i64 2
%45 = bitcast double* %44 to <2 x double>*
store <2 x double> %41, <2 x double>* %45
%46 = or i64 %31, 5
%47 = getelementptr inbounds float, float* %4, i64 %46
%48 = bitcast float* %47 to <2 x float>*
%49 = load <2 x float>, <2 x float>* %48
%50 = getelementptr inbounds float, float* %47, i64 2
%51 = bitcast float* %50 to <2 x float>*
%52 = load <2 x float>, <2 x float>* %51
%53 = fpext <2 x float> %49 to <2 x double>
%54 = fpext <2 x float> %52 to <2 x double>
%55 = getelementptr inbounds double, double* %14, i64 %46
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %53, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %54, <2 x double>* %58
%59 = add nuw i64 %31, 8
%60 = add i64 %32, 2
%61 = icmp eq i64 %60, %29
br i1 %61, label %62, label %30
62: ; preds = %30
%63 = or i64 %59, 1
br label %64
64: ; preds = %62, %20
%65 = phi i64 [ 1, %20 ], [ %63, %62 ]
%66 = icmp eq i64 %26, 0
br i1 %66, label %80, label %67
67: ; preds = %64
%68 = getelementptr inbounds float, float* %4, i64 %65
%69 = bitcast float* %68 to <2 x float>*
%70 = load <2 x float>, <2 x float>* %69
%71 = getelementptr inbounds float, float* %68, i64 2
%72 = bitcast float* %71 to <2 x float>*
%73 = load <2 x float>, <2 x float>* %72
%74 = fpext <2 x float> %70 to <2 x double>
%75 = fpext <2 x float> %73 to <2 x double>
%76 = getelementptr inbounds double, double* %14, i64 %65
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %74, <2 x double>* %77
%78 = getelementptr inbounds double, double* %76, i64 2
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> %75, <2 x double>* %79
br label %80
80: ; preds = %64, %67
%81 = icmp eq i64 %18, %21
br i1 %81, label %92, label %82
82: ; preds = %16, %80
%83 = phi i64 [ 1, %16 ], [ %22, %80 ]
br label %84
84: ; preds = %82, %84
%85 = phi i64 [ %90, %84 ], [ %83, %82 ]
%86 = getelementptr inbounds float, float* %4, i64 %85
%87 = load float, float* %86
%88 = fpext float %87 to double
%89 = getelementptr inbounds double, double* %14, i64 %85
store double %88, double* %89
%90 = add nuw nsw i64 %85, 1
%91 = icmp eq i64 %90, %17
br i1 %91, label %92, label %84
92: ; preds = %84, %80, %8
%93 = sext i32 %1 to i64
%94 = shl nsw i64 %93, 2
%95 = tail call i32 (i64, ...) bitcast (i32 (...)* @smalloc to i32 (i64, ...)*)(i64 %94)
%96 = sext i32 %95 to i64
%97 = inttoptr i64 %96 to i32*
%98 = tail call double (...) @seconds()
tail call void (%struct.vtx_data**, double*, i32, i32*, i32, i32, double*, i32, i32*, i32, ...) bitcast (void (...)* @rec_median_1 to void (%struct.vtx_data**, double*, i32, i32*, i32, i32, double*, i32, i32*, i32, ...)*)(%struct.vtx_data** %0, double* %14, i32 %1, i32* %97, i32 %2, i32 %3, double* %6, i32 %7, i32* %5, i32 1)
%99 = tail call double (...) @seconds()
%100 = fsub double %99, %98
%101 = load double, double* @median_time
%102 = fadd double %101, %100
store double %102, double* @median_time
%103 = tail call i32 (i32*, ...) bitcast (i32 (...)* @sfree to i32 (i32*, ...)*)(i32* %97)
%104 = tail call i32 (double*, ...) bitcast (i32 (...)* @sfree to i32 (double*, ...)*)(double* %14)
ret void
}