void set_haproxy_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 < 3; i++) {
    st_array[i] = cur_array[i];
  }
  if (cur_array[3] > pre_array[3]) {
    st_array[3] = (cur_array[3] - pre_array[3]) / inter;
  } else {
    st_array[3] = 0;
  }
  st_array[4] = cur_array[4] / 10.0;
  st_array[5] = cur_array[5] / 100.0;
}


x86 assembly (clang, -O0):
<set_haproxy_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   $0x3,-0x28(%rbp)
jge    1173 <set_haproxy_record+0x73>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movq   (%rax,%rcx,8),%xmm0
movaps 0xec3(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xec7(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    111f <set_haproxy_record+0x1f>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x18(%rcx),%rax
jbe    11da <set_haproxy_record+0xda>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x18(%rbp),%rcx
mov    0x18(%rcx),%rcx
sub    %rcx,%rax
movslq -0x24(%rbp),%rcx
xor    %edx,%edx
div    %rcx
movq   %rax,%xmm0
movaps 0xe4f(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xe53(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    11e6 <set_haproxy_record+0xe6>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x20(%rbp),%rax
movq   0x20(%rax),%xmm0
movaps 0xe0a(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xe0e(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  0xe0f(%rip),%xmm3
divsd  %xmm3,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x20(%rbp),%rax
movq   0x28(%rax),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdd6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_haproxy_record>:
movdqu (%rcx),%xmm0
movdqa 0xef4(%rip),%xmm1
pand   %xmm0,%xmm1
por    0xef8(%rip),%xmm1
psrlq  $0x20,%xmm0
por    0xefb(%rip),%xmm0
subpd  0xf03(%rip),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm0,(%rsi)
movsd  0x10(%rcx),%xmm0
unpcklps 0xeff(%rip),%xmm0
subpd  0xf07(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsi)
mov    0x18(%rcx),%rax
xorpd  %xmm0,%xmm0
sub    0x18(%rdx),%rax
jbe    11a4 <set_haproxy_record+0xa4>
movslq %r8d,%rdi
mov    %rax,%rdx
or     %rdi,%rdx
shr    $0x20,%rdx
je     117e <set_haproxy_record+0x7e>
xor    %edx,%edx
div    %rdi
jmp    1183 <set_haproxy_record+0x83>
xor    %edx,%edx
div    %r8d
movq   %rax,%xmm1
punpckldq 0xeb0(%rip),%xmm1
subpd  0xeb8(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsi)
movdqu 0x20(%rcx),%xmm0
movdqa 0xe4a(%rip),%xmm1
pand   %xmm0,%xmm1
por    0xe4e(%rip),%xmm1
psrlq  $0x20,%xmm0
por    0xe51(%rip),%xmm0
subpd  0xe59(%rip),%xmm0
addpd  %xmm1,%xmm0
divpd  0xe7d(%rip),%xmm0
movupd %xmm0,0x20(%rsi)
ret

LLVM IR (-O0):
%struct.module = type opaque
define void @set_haproxy_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 = %26, %5
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %29
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 = uitofp i64 %20 to double
%22 = load double*, double** %7
%23 = load i32, i32* %11
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
store double %21, double* %25
br label %26
26: ; preds = %15
%27 = load i32, i32* %11
%28 = add nsw i32 %27, 1
store i32 %28, i32* %11
br label %12
29: ; preds = %12
%30 = load i64*, i64** %9
%31 = getelementptr inbounds i64, i64* %30, i64 3
%32 = load i64, i64* %31
%33 = load i64*, i64** %8
%34 = getelementptr inbounds i64, i64* %33, i64 3
%35 = load i64, i64* %34
%36 = icmp ugt i64 %32, %35
br i1 %36, label %37, label %51
37: ; preds = %29
%38 = load i64*, i64** %9
%39 = getelementptr inbounds i64, i64* %38, i64 3
%40 = load i64, i64* %39
%41 = load i64*, i64** %8
%42 = getelementptr inbounds i64, i64* %41, i64 3
%43 = load i64, i64* %42
%44 = sub i64 %40, %43
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = udiv i64 %44, %46
%48 = uitofp i64 %47 to double
%49 = load double*, double** %7
%50 = getelementptr inbounds double, double* %49, i64 3
store double %48, double* %50
br label %54
51: ; preds = %29
%52 = load double*, double** %7
%53 = getelementptr inbounds double, double* %52, i64 3
store double 0.000000e+00, double* %53
br label %54
54: ; preds = %51, %37
%55 = load i64*, i64** %9
%56 = getelementptr inbounds i64, i64* %55, i64 4
%57 = load i64, i64* %56
%58 = uitofp i64 %57 to double
%59 = fdiv double %58, 1.000000e+01
%60 = load double*, double** %7
%61 = getelementptr inbounds double, double* %60, i64 4
store double %59, double* %61
%62 = load i64*, i64** %9
%63 = getelementptr inbounds i64, i64* %62, i64 5
%64 = load i64, i64* %63
%65 = uitofp i64 %64 to double
%66 = fdiv double %65, 1.000000e+02
%67 = load double*, double** %7
%68 = getelementptr inbounds double, double* %67, i64 5
store double %66, double* %68
ret void
}

LLVM IR (-O2):
%struct.module = type opaque
define void @set_haproxy_record(%struct.module* nocapture readnone %0, double* nocapture writeonly %1, i64* nocapture %2, i64* nocapture %3, i32 %4) {
%6 = bitcast i64* %3 to <2 x i64>*
%7 = load <2 x i64>, <2 x i64>* %6
%8 = uitofp <2 x i64> %7 to <2 x double>
%9 = bitcast double* %1 to <2 x double>*
store <2 x double> %8, <2 x double>* %9
%10 = getelementptr inbounds i64, i64* %3, i64 2
%11 = load i64, i64* %10
%12 = uitofp i64 %11 to double
%13 = getelementptr inbounds double, double* %1, i64 2
store double %12, double* %13
%14 = getelementptr inbounds i64, i64* %3, i64 3
%15 = load i64, i64* %14
%16 = getelementptr inbounds i64, i64* %2, i64 3
%17 = load i64, i64* %16
%18 = icmp ugt i64 %15, %17
br i1 %18, label %19, label %24
19: ; preds = %5
%20 = sub i64 %15, %17
%21 = sext i32 %4 to i64
%22 = udiv i64 %20, %21
%23 = uitofp i64 %22 to double
br label %24
24: ; preds = %5, %19
%25 = phi double [ %23, %19 ], [ 0.000000e+00, %5 ]
%26 = getelementptr inbounds double, double* %1, i64 3
store double %25, double* %26
%27 = getelementptr inbounds i64, i64* %3, i64 4
%28 = getelementptr inbounds double, double* %1, i64 4
%29 = bitcast i64* %27 to <2 x i64>*
%30 = load <2 x i64>, <2 x i64>* %29
%31 = uitofp <2 x i64> %30 to <2 x double>
%32 = fdiv <2 x double> %31, <double 1.000000e+01, double 1.000000e+02>
%33 = bitcast double* %28 to <2 x double>*
store <2 x double> %32, <2 x double>* %33
ret void
}