void set_ts_clusterio_record(struct module *mod, double st_array[],
                             unsigned long long pre_array[],
                             unsigned long long cur_array[], int inter) {
  int i;
  for (i = 0; i < 12; i++) {
    if (cur_array[i] >= pre_array[i]) {
      st_array[i] = (cur_array[i] - pre_array[i]) * 1.0 / inter;
    } else {
      st_array[i] = 0;
    }
  }
  if (st_array[0] > 0) {
    st_array[1] = st_array[1] / st_array[0];
  } else {
    st_array[1] = 0;
  }
  if (st_array[2] > 0) {
    st_array[3] = st_array[3] / st_array[2];
  } else {
    st_array[3] = 0;
  }
  if (st_array[5] > 0) {
    st_array[6] = st_array[6] / st_array[5];
  } else {
    st_array[6] = 0;
  }
  if (st_array[2] > 0) {
    st_array[8] = st_array[8] / st_array[2];
  } else {
    st_array[8] = 0;
  }
  if (st_array[9] > 0) {
    st_array[10] = st_array[10] / st_array[9];
  } else {
    st_array[10] = 0;
  }
}


x86 assembly (clang, -O0):
<set_ts_clusterio_record>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0xc,-0x28(%rbp)
jge    11cf <set_ts_clusterio_record+0xcf>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
jb     11ac <set_ts_clusterio_record+0xac>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx,%rdx,8),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xea6(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xeaa(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11bc <set_ts_clusterio_record+0xbc>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11c1 <set_ts_clusterio_record+0xc1>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    111f <set_ts_clusterio_record+0x1f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1203 <set_ts_clusterio_record+0x103>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    120f <set_ts_clusterio_record+0x10f>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1245 <set_ts_clusterio_record+0x145>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    1251 <set_ts_clusterio_record+0x151>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1287 <set_ts_clusterio_record+0x187>
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
jmp    1293 <set_ts_clusterio_record+0x193>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12c9 <set_ts_clusterio_record+0x1c9>
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
jmp    12d5 <set_ts_clusterio_record+0x1d5>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x40(%rax)
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    130b <set_ts_clusterio_record+0x20b>
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x48(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x50(%rax)
jmp    1317 <set_ts_clusterio_record+0x217>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x50(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ts_clusterio_record>:
cvtsi2sd %r8d,%xmm0
xor    %eax,%eax
movdqa 0xef1(%rip),%xmm1
movapd 0xef9(%rip),%xmm2
jmp    112f <set_ts_clusterio_record+0x2f>
nopl   0x0(%rax)
movsd  %xmm3,(%rsi,%rax,8)
add    $0x1,%rax
cmp    $0xc,%rax
je     115c <set_ts_clusterio_record+0x5c>
mov    (%rcx,%rax,8),%rdi
xorpd  %xmm3,%xmm3
sub    (%rdx,%rax,8),%rdi
jb     1120 <set_ts_clusterio_record+0x20>
movq   %rdi,%xmm4
punpckldq %xmm1,%xmm4
subpd  %xmm2,%xmm4
movapd %xmm4,%xmm3
unpckhpd %xmm4,%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm0,%xmm3
jmp    1120 <set_ts_clusterio_record+0x20>
movsd  (%rsi),%xmm0
pxor   %xmm1,%xmm1
ucomisd %xmm1,%xmm0
xorpd  %xmm2,%xmm2
jbe    1177 <set_ts_clusterio_record+0x77>
movsd  0x8(%rsi),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsi)
movsd  0x10(%rsi),%xmm0
ucomisd %xmm1,%xmm0
jbe    1190 <set_ts_clusterio_record+0x90>
movsd  0x18(%rsi),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsi)
movsd  0x28(%rsi),%xmm3
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
xorpd  %xmm2,%xmm2
jbe    11b1 <set_ts_clusterio_record+0xb1>
movsd  0x30(%rsi),%xmm2
divsd  %xmm3,%xmm2
ucomisd %xmm1,%xmm0
movsd  %xmm2,0x30(%rsi)
jbe    11c5 <set_ts_clusterio_record+0xc5>
movsd  0x40(%rsi),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%rsi)
movsd  0x48(%rsi),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    11e2 <set_ts_clusterio_record+0xe2>
movsd  0x50(%rsi),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x50(%rsi)
ret

LLVM IR (-O0):
%struct.module = type opaque
define void @set_ts_clusterio_record(%struct.module* %0, double* %1, i64* %2, i64* %3, i32 %4) {
%6 = alloca %struct.module*
%7 = alloca double*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i32
%11 = alloca i32
store %struct.module* %0, %struct.module** %6
store double* %1, double** %7
store i64* %2, i64** %8
store i64* %3, i64** %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %54, %5
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 12
br i1 %14, label %15, label %57
15: ; preds = %12
%16 = load i64*, i64** %9
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i64, i64* %16, i64 %18
%20 = load i64, i64* %19
%21 = load i64*, i64** %8
%22 = load i32, i32* %11
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i64, i64* %21, i64 %23
%25 = load i64, i64* %24
%26 = icmp uge i64 %20, %25
br i1 %26, label %27, label %48
27: ; preds = %15
%28 = load i64*, i64** %9
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i64, i64* %28, i64 %30
%32 = load i64, i64* %31
%33 = load i64*, i64** %8
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i64, i64* %33, i64 %35
%37 = load i64, i64* %36
%38 = sub i64 %32, %37
%39 = uitofp i64 %38 to double
%40 = fmul double %39, 1.000000e+00
%41 = load i32, i32* %10
%42 = sitofp i32 %41 to double
%43 = fdiv double %40, %42
%44 = load double*, double** %7
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
br label %53
48: ; preds = %15
%49 = load double*, double** %7
%50 = load i32, i32* %11
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double 0.000000e+00, double* %52
br label %53
53: ; preds = %48, %27
br label %54
54: ; preds = %53
%55 = load i32, i32* %11
%56 = add nsw i32 %55, 1
store i32 %56, i32* %11
br label %12
57: ; preds = %12
%58 = load double*, double** %7
%59 = getelementptr inbounds double, double* %58, i64 0
%60 = load double, double* %59
%61 = fcmp ogt double %60, 0.000000e+00
br i1 %61, label %62, label %72
62: ; preds = %57
%63 = load double*, double** %7
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
%66 = load double*, double** %7
%67 = getelementptr inbounds double, double* %66, i64 0
%68 = load double, double* %67
%69 = fdiv double %65, %68
%70 = load double*, double** %7
%71 = getelementptr inbounds double, double* %70, i64 1
store double %69, double* %71
br label %75
72: ; preds = %57
%73 = load double*, double** %7
%74 = getelementptr inbounds double, double* %73, i64 1
store double 0.000000e+00, double* %74
br label %75
75: ; preds = %72, %62
%76 = load double*, double** %7
%77 = getelementptr inbounds double, double* %76, i64 2
%78 = load double, double* %77
%79 = fcmp ogt double %78, 0.000000e+00
br i1 %79, label %80, label %90
80: ; preds = %75
%81 = load double*, double** %7
%82 = getelementptr inbounds double, double* %81, i64 3
%83 = load double, double* %82
%84 = load double*, double** %7
%85 = getelementptr inbounds double, double* %84, i64 2
%86 = load double, double* %85
%87 = fdiv double %83, %86
%88 = load double*, double** %7
%89 = getelementptr inbounds double, double* %88, i64 3
store double %87, double* %89
br label %93
90: ; preds = %75
%91 = load double*, double** %7
%92 = getelementptr inbounds double, double* %91, i64 3
store double 0.000000e+00, double* %92
br label %93
93: ; preds = %90, %80
%94 = load double*, double** %7
%95 = getelementptr inbounds double, double* %94, i64 5
%96 = load double, double* %95
%97 = fcmp ogt double %96, 0.000000e+00
br i1 %97, label %98, label %108
98: ; preds = %93
%99 = load double*, double** %7
%100 = getelementptr inbounds double, double* %99, i64 6
%101 = load double, double* %100
%102 = load double*, double** %7
%103 = getelementptr inbounds double, double* %102, i64 5
%104 = load double, double* %103
%105 = fdiv double %101, %104
%106 = load double*, double** %7
%107 = getelementptr inbounds double, double* %106, i64 6
store double %105, double* %107
br label %111
108: ; preds = %93
%109 = load double*, double** %7
%110 = getelementptr inbounds double, double* %109, i64 6
store double 0.000000e+00, double* %110
br label %111
111: ; preds = %108, %98
%112 = load double*, double** %7
%113 = getelementptr inbounds double, double* %112, i64 2
%114 = load double, double* %113
%115 = fcmp ogt double %114, 0.000000e+00
br i1 %115, label %116, label %126
116: ; preds = %111
%117 = load double*, double** %7
%118 = getelementptr inbounds double, double* %117, i64 8
%119 = load double, double* %118
%120 = load double*, double** %7
%121 = getelementptr inbounds double, double* %120, i64 2
%122 = load double, double* %121
%123 = fdiv double %119, %122
%124 = load double*, double** %7
%125 = getelementptr inbounds double, double* %124, i64 8
store double %123, double* %125
br label %129
126: ; preds = %111
%127 = load double*, double** %7
%128 = getelementptr inbounds double, double* %127, i64 8
store double 0.000000e+00, double* %128
br label %129
129: ; preds = %126, %116
%130 = load double*, double** %7
%131 = getelementptr inbounds double, double* %130, i64 9
%132 = load double, double* %131
%133 = fcmp ogt double %132, 0.000000e+00
br i1 %133, label %134, label %144
134: ; preds = %129
%135 = load double*, double** %7
%136 = getelementptr inbounds double, double* %135, i64 10
%137 = load double, double* %136
%138 = load double*, double** %7
%139 = getelementptr inbounds double, double* %138, i64 9
%140 = load double, double* %139
%141 = fdiv double %137, %140
%142 = load double*, double** %7
%143 = getelementptr inbounds double, double* %142, i64 10
store double %141, double* %143
br label %147
144: ; preds = %129
%145 = load double*, double** %7
%146 = getelementptr inbounds double, double* %145, i64 10
store double 0.000000e+00, double* %146
br label %147
147: ; preds = %144, %134
ret void
}

LLVM IR (-O2):
%struct.module = type opaque
define void @set_ts_clusterio_record(%struct.module* nocapture readnone %0, double* nocapture %1, i64* nocapture %2, i64* nocapture %3, i32 %4) {
%6 = sitofp i32 %4 to double
br label %7
7: ; preds = %5, %18
%8 = phi i64 [ 0, %5 ], [ %21, %18 ]
%9 = getelementptr inbounds i64, i64* %3, i64 %8
%10 = load i64, i64* %9
%11 = getelementptr inbounds i64, i64* %2, i64 %8
%12 = load i64, i64* %11
%13 = icmp ult i64 %10, %12
br i1 %13, label %18, label %14
14: ; preds = %7
%15 = sub i64 %10, %12
%16 = uitofp i64 %15 to double
%17 = fdiv double %16, %6
br label %18
18: ; preds = %7, %14
%19 = phi double [ %17, %14 ], [ 0.000000e+00, %7 ]
%20 = getelementptr inbounds double, double* %1, i64 %8
store double %19, double* %20
%21 = add nuw nsw i64 %8, 1
%22 = icmp eq i64 %21, 12
br i1 %22, label %23, label %7
23: ; preds = %18
%24 = load double, double* %1
%25 = fcmp ogt double %24, 0.000000e+00
%26 = getelementptr inbounds double, double* %1, i64 1
br i1 %25, label %27, label %30
27: ; preds = %23
%28 = load double, double* %26
%29 = fdiv double %28, %24
br label %30
30: ; preds = %23, %27
%31 = phi double [ %29, %27 ], [ 0.000000e+00, %23 ]
store double %31, double* %26
%32 = getelementptr inbounds double, double* %1, i64 2
%33 = load double, double* %32
%34 = fcmp ogt double %33, 0.000000e+00
%35 = getelementptr inbounds double, double* %1, i64 3
br i1 %34, label %36, label %39
36: ; preds = %30
%37 = load double, double* %35
%38 = fdiv double %37, %33
br label %39
39: ; preds = %30, %36
%40 = phi double [ %38, %36 ], [ 0.000000e+00, %30 ]
store double %40, double* %35
%41 = getelementptr inbounds double, double* %1, i64 5
%42 = load double, double* %41
%43 = fcmp ogt double %42, 0.000000e+00
%44 = getelementptr inbounds double, double* %1, i64 6
br i1 %43, label %45, label %48
45: ; preds = %39
%46 = load double, double* %44
%47 = fdiv double %46, %42
br label %48
48: ; preds = %39, %45
%49 = phi double [ %47, %45 ], [ 0.000000e+00, %39 ]
store double %49, double* %44
%50 = getelementptr inbounds double, double* %1, i64 8
br i1 %34, label %51, label %54
51: ; preds = %48
%52 = load double, double* %50
%53 = fdiv double %52, %33
br label %54
54: ; preds = %48, %51
%55 = phi double [ %53, %51 ], [ 0.000000e+00, %48 ]
store double %55, double* %50
%56 = getelementptr inbounds double, double* %1, i64 9
%57 = load double, double* %56
%58 = fcmp ogt double %57, 0.000000e+00
%59 = getelementptr inbounds double, double* %1, i64 10
br i1 %58, label %60, label %63
60: ; preds = %54
%61 = load double, double* %59
%62 = fdiv double %61, %57
br label %63
63: ; preds = %54, %60
%64 = phi double [ %62, %60 ], [ 0.000000e+00, %54 ]
store double %64, double* %59
ret void
}