void remove_reaction(double **react_list, double **to_remove, int n_reacs,
                     double *coeff_list) {
  double *tmp, c_tmp;
  tmp = *to_remove;
  *to_remove = *(react_list + n_reacs - 1);
  *(react_list + n_reacs - 1) = tmp;
  c_tmp = *(coeff_list + (int)(to_remove - react_list));
  *(coeff_list + (int)(to_remove - react_list)) = *(coeff_list + n_reacs - 1);
  *(coeff_list + n_reacs - 1) = c_tmp;
}


x86 assembly (clang, -O0):
<remove_reaction>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    -0x8(%rax,%rcx,8),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,-0x8(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
sar    $0x3,%rcx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  -0x8(%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
sar    $0x3,%rcx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,-0x8(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_reaction>:
mov    (%rsi),%r8
movslq %edx,%rdx
mov    -0x8(%rdi,%rdx,8),%rax
mov    %rax,(%rsi)
mov    %r8,-0x8(%rdi,%rdx,8)
sub    %rdi,%rsi
shr    $0x3,%rsi
movslq %esi,%rax
movsd  (%rcx,%rax,8),%xmm0
movsd  -0x8(%rcx,%rdx,8),%xmm1
movsd  %xmm1,(%rcx,%rax,8)
movsd  %xmm0,-0x8(%rcx,%rdx,8)
ret

LLVM IR (-O0):
define void @remove_reaction(double** %0, double** %1, i32 %2, double* %3) {
%5 = alloca double**
%6 = alloca double**
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
store double** %0, double*** %5
store double** %1, double*** %6
store i32 %2, i32* %7
store double* %3, double** %8
%11 = load double**, double*** %6
%12 = load double*, double** %11
store double* %12, double** %9
%13 = load double**, double*** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double*, double** %13, i64 %15
%17 = getelementptr inbounds double*, double** %16, i64 -1
%18 = load double*, double** %17
%19 = load double**, double*** %6
store double* %18, double** %19
%20 = load double*, double** %9
%21 = load double**, double*** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double*, double** %21, i64 %23
%25 = getelementptr inbounds double*, double** %24, i64 -1
store double* %20, double** %25
%26 = load double*, double** %8
%27 = load double**, double*** %6
%28 = load double**, double*** %5
%29 = ptrtoint double** %27 to i64
%30 = ptrtoint double** %28 to i64
%31 = sub i64 %29, %30
%32 = sdiv exact i64 %31, 8
%33 = trunc i64 %32 to i32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %26, i64 %34
%36 = load double, double* %35
store double %36, double* %10
%37 = load double*, double** %8
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = getelementptr inbounds double, double* %40, i64 -1
%42 = load double, double* %41
%43 = load double*, double** %8
%44 = load double**, double*** %6
%45 = load double**, double*** %5
%46 = ptrtoint double** %44 to i64
%47 = ptrtoint double** %45 to i64
%48 = sub i64 %46, %47
%49 = sdiv exact i64 %48, 8
%50 = trunc i64 %49 to i32
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %43, i64 %51
store double %42, double* %52
%53 = load double, double* %10
%54 = load double*, double** %8
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
%58 = getelementptr inbounds double, double* %57, i64 -1
store double %53, double* %58
ret void
}

LLVM IR (-O2):
define void @remove_reaction(double** %0, double** %1, i32 %2, double* nocapture %3) {
%5 = load double*, double** %1
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds double*, double** %0, i64 %6
%8 = getelementptr inbounds double*, double** %7, i64 -1
%9 = load double*, double** %8
store double* %9, double** %1
store double* %5, double** %8
%10 = ptrtoint double** %1 to i64
%11 = ptrtoint double** %0 to i64
%12 = sub i64 %10, %11
%13 = shl i64 %12, 29
%14 = ashr i64 %13, 32
%15 = getelementptr inbounds double, double* %3, i64 %14
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %3, i64 %6
%18 = getelementptr inbounds double, double* %17, i64 -1
%19 = load double, double* %18
store double %19, double* %15
store double %16, double* %18
ret void
}