#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 fabs(int /*<<< orphan*/);
int /*<<< orphan*/ gaussdev();
void initialise_fluxes(double *s, int Nreact, double **locked, int n_locked,
                       double *lock_value) {
  double *dummy, **dummy_l, *lock_v, Z = 0., Z_l = 0.;
  for (dummy = s; dummy < s + Nreact; dummy++) {
    *dummy = fabs(gaussdev());
    Z += *dummy;
  }
  for (dummy = s; dummy < s + Nreact; dummy++) {
    *dummy *= ((double)Nreact - Z_l) / Z;
  }
  lock_v = lock_value;
  for (dummy_l = locked; dummy_l < locked + n_locked; dummy_l++) {
    **dummy_l = *lock_v;
    lock_v++;
  }
}


x86 assembly (clang, -O0):
<initialise_fluxes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    11a7 <initialise_fluxes+0x87>
mov    $0x0,%al
call   1030 <gaussdev@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
jmp    1152 <initialise_fluxes+0x32>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    11f7 <initialise_fluxes+0xd7>
cvtsi2sdl -0xc(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
jmp    11af <initialise_fluxes+0x8f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1253 <initialise_fluxes+0x133>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
jmp    1207 <initialise_fluxes+0xe7>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialise_fluxes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rdx,%rbx
test   %esi,%esi
jle    12a7 <initialise_fluxes+0x187>
mov    %esi,%r12d
mov    %rdi,%r15
mov    %ecx,0xc(%rsp)
movslq %esi,%rax
lea    (%rdi,%rax,8),%r13
xorpd  %xmm1,%xmm1
mov    %rdi,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm1,0x10(%rsp)
xor    %eax,%eax
call   1030 <gaussdev@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,0x0(%rbp)
addsd  %xmm0,%xmm1
add    $0x8,%rbp
cmp    %r13,%rbp
jb     1160 <initialise_fluxes+0x40>
test   %r12d,%r12d
mov    0xc(%rsp),%ecx
jle    12a7 <initialise_fluxes+0x187>
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
lea    0x8(%r15),%rdx
cmp    %rdx,%r13
cmova  %r13,%rdx
divsd  %xmm1,%xmm0
mov    %r15,%rax
not    %rax
add    %rdx,%rax
cmp    $0x18,%rax
jb     1290 <initialise_fluxes+0x170>
shr    $0x3,%rax
add    $0x1,%rax
mov    %rax,%rbp
and    $0xfffffffffffffffc,%rbp
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rbp),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     12e8 <initialise_fluxes+0x1c8>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd (%r15,%rdx,8),%xmm2
movupd 0x10(%r15,%rdx,8),%xmm3
movupd 0x20(%r15,%rdx,8),%xmm4
movupd 0x30(%r15,%rdx,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%r15,%rdx,8)
movupd %xmm3,0x10(%r15,%rdx,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%r15,%rdx,8)
movupd %xmm5,0x30(%r15,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1200 <initialise_fluxes+0xe0>
test   $0x1,%sil
je     1278 <initialise_fluxes+0x158>
movupd (%r15,%rdx,8),%xmm2
movupd 0x10(%r15,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%r15,%rdx,8)
movupd %xmm3,0x10(%r15,%rdx,8)
cmp    %rbp,%rax
je     12a7 <initialise_fluxes+0x187>
lea    (%r15,%rbp,8),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
add    $0x8,%r15
cmp    %r13,%r15
jb     1290 <initialise_fluxes+0x170>
test   %ecx,%ecx
jle    12d9 <initialise_fluxes+0x1b9>
movslq %ecx,%rax
lea    (%rbx,%rax,8),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14),%xmm0
mov    (%rbx),%rcx
movsd  %xmm0,(%rcx)
add    $0x8,%r14
add    $0x8,%rbx
cmp    %rax,%rbx
jb     12c0 <initialise_fluxes+0x1a0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1256 <initialise_fluxes+0x136>
jmp    1278 <initialise_fluxes+0x158>

LLVM IR (-O0):
define void @initialise_fluxes(double* %0, i32 %1, double** %2, i32 %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double**
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double**
%13 = alloca double*
%14 = alloca double
%15 = alloca double
store double* %0, double** %6
store i32 %1, i32* %7
store double** %2, double*** %8
store i32 %3, i32* %9
store double* %4, double** %10
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %15
%16 = load double*, double** %6
store double* %16, double** %11
br label %17
17: ; preds = %32, %5
%18 = load double*, double** %11
%19 = load double*, double** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = icmp ult double* %18, %22
br i1 %23, label %24, label %35
24: ; preds = %17
%25 = call i32 (...) @gaussdev()
%26 = call double @fabs(i32 %25)
%27 = load double*, double** %11
store double %26, double* %27
%28 = load double*, double** %11
%29 = load double, double* %28
%30 = load double, double* %14
%31 = fadd double %30, %29
store double %31, double* %14
br label %32
32: ; preds = %24
%33 = load double*, double** %11
%34 = getelementptr inbounds double, double* %33, i32 1
store double* %34, double** %11
br label %17
35: ; preds = %17
%36 = load double*, double** %6
store double* %36, double** %11
br label %37
37: ; preds = %54, %35
%38 = load double*, double** %11
%39 = load double*, double** %6
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = icmp ult double* %38, %42
br i1 %43, label %44, label %57
44: ; preds = %37
%45 = load i32, i32* %7
%46 = sitofp i32 %45 to double
%47 = load double, double* %15
%48 = fsub double %46, %47
%49 = load double, double* %14
%50 = fdiv double %48, %49
%51 = load double*, double** %11
%52 = load double, double* %51
%53 = fmul double %52, %50
store double %53, double* %51
br label %54
54: ; preds = %44
%55 = load double*, double** %11
%56 = getelementptr inbounds double, double* %55, i32 1
store double* %56, double** %11
br label %37
57: ; preds = %37
%58 = load double*, double** %10
store double* %58, double** %13
%59 = load double**, double*** %8
store double** %59, double*** %12
br label %60
60: ; preds = %74, %57
%61 = load double**, double*** %12
%62 = load double**, double*** %8
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double*, double** %62, i64 %64
%66 = icmp ult double** %61, %65
br i1 %66, label %67, label %77
67: ; preds = %60
%68 = load double*, double** %13
%69 = load double, double* %68
%70 = load double**, double*** %12
%71 = load double*, double** %70
store double %69, double* %71
%72 = load double*, double** %13
%73 = getelementptr inbounds double, double* %72, i32 1
store double* %73, double** %13
br label %74
74: ; preds = %67
%75 = load double**, double*** %12
%76 = getelementptr inbounds double*, double** %75, i32 1
store double** %76, double*** %12
br label %60
77: ; preds = %60
ret void
}

LLVM IR (-O2):
define void @initialise_fluxes(double* %0, i32 %1, double** %2, i32 %3, double* nocapture %4) {
%6 = ptrtoint double* %0 to i64
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = icmp sgt i32 %1, 0
br i1 %9, label %82, label %90
10: ; preds = %82
br i1 %9, label %11, label %90
11: ; preds = %10
%12 = sitofp i32 %1 to double
%13 = fdiv double %12, %87
%14 = shl nsw i64 %7, 3
%15 = add i64 %14, %6
%16 = add i64 %6, 8
%17 = call i64 @llvm.umax.i64(i64 %15, i64 %16)
%18 = xor i64 %6, -1
%19 = add i64 %17, %18
%20 = lshr i64 %19, 3
%21 = add nuw nsw i64 %20, 1
%22 = icmp ult i64 %19, 24
br i1 %22, label %80, label %23
23: ; preds = %11
%24 = and i64 %21, 4611686018427387900
%25 = getelementptr double, double* %0, i64 %24
%26 = insertelement <2 x double> poison, double %13, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %13, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = add nsw i64 %24, -4
%31 = lshr exact i64 %30, 2
%32 = add nuw nsw i64 %31, 1
%33 = and i64 %32, 1
%34 = icmp eq i64 %30, 0
br i1 %34, label %64, label %35
35: ; preds = %23
%36 = and i64 %32, 9223372036854775806
br label %37
37: ; preds = %37, %35
%38 = phi i64 [ 0, %35 ], [ %61, %37 ]
%39 = phi i64 [ 0, %35 ], [ %62, %37 ]
%40 = getelementptr double, double* %0, i64 %38
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr double, double* %40, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = fmul <2 x double> %27, %42
%47 = fmul <2 x double> %29, %45
%48 = bitcast double* %40 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = bitcast double* %43 to <2 x double>*
store <2 x double> %47, <2 x double>* %49
%50 = or i64 %38, 4
%51 = getelementptr double, double* %0, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr double, double* %51, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = fmul <2 x double> %27, %53
%58 = fmul <2 x double> %29, %56
%59 = bitcast double* %51 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = bitcast double* %54 to <2 x double>*
store <2 x double> %58, <2 x double>* %60
%61 = add nuw i64 %38, 8
%62 = add i64 %39, 2
%63 = icmp eq i64 %62, %36
br i1 %63, label %64, label %37
64: ; preds = %37, %23
%65 = phi i64 [ 0, %23 ], [ %61, %37 ]
%66 = icmp eq i64 %33, 0
br i1 %66, label %78, label %67
67: ; preds = %64
%68 = getelementptr double, double* %0, i64 %65
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = getelementptr double, double* %68, i64 2
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = fmul <2 x double> %27, %70
%75 = fmul <2 x double> %29, %73
%76 = bitcast double* %68 to <2 x double>*
store <2 x double> %74, <2 x double>* %76
%77 = bitcast double* %71 to <2 x double>*
store <2 x double> %75, <2 x double>* %77
br label %78
78: ; preds = %64, %67
%79 = icmp eq i64 %21, %24
br i1 %79, label %90, label %80
80: ; preds = %11, %78
%81 = phi double* [ %0, %11 ], [ %25, %78 ]
br label %94
82: ; preds = %5, %82
%83 = phi double* [ %88, %82 ], [ %0, %5 ]
%84 = phi double [ %87, %82 ], [ 0.000000e+00, %5 ]
%85 = tail call i32 (...) @gaussdev()
%86 = tail call double @fabs(i32 %85)
store double %86, double* %83
%87 = fadd double %84, %86
%88 = getelementptr inbounds double, double* %83, i64 1
%89 = icmp ult double* %88, %8
br i1 %89, label %82, label %10
90: ; preds = %94, %78, %5, %10
%91 = sext i32 %3 to i64
%92 = getelementptr inbounds double*, double** %2, i64 %91
%93 = icmp sgt i32 %3, 0
br i1 %93, label %100, label %108
94: ; preds = %80, %94
%95 = phi double* [ %98, %94 ], [ %81, %80 ]
%96 = load double, double* %95
%97 = fmul double %13, %96
store double %97, double* %95
%98 = getelementptr inbounds double, double* %95, i64 1
%99 = icmp ult double* %98, %8
br i1 %99, label %94, label %90
100: ; preds = %90, %100
%101 = phi double* [ %105, %100 ], [ %4, %90 ]
%102 = phi double** [ %106, %100 ], [ %2, %90 ]
%103 = load double, double* %101
%104 = load double*, double** %102
store double %103, double* %104
%105 = getelementptr inbounds double, double* %101, i64 1
%106 = getelementptr inbounds double*, double** %102, i64 1
%107 = icmp ult double** %106, %92
br i1 %107, label %100, label %108
108: ; preds = %100, %90
ret void
}