void set_ts_storage_record(struct module *mod, double st_array[],
                           unsigned long long pre_array[],
                           unsigned long long cur_array[], int inter) {
  int i;
  st_array[3] = 0;
  for (i = 0; i < 3; ++i) {
    st_array[i] = cur_array[i];
  }
  if (cur_array[2] != 0) {
    st_array[3] = st_array[1] / st_array[2];
  }
}


x86 assembly (clang, -O0):
<set_ts_storage_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)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    117f <set_ts_storage_record+0x7f>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movq   (%rax,%rcx,8),%xmm0
movaps 0xeb7(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xebb(%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    112b <set_ts_storage_record+0x2b>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11a9 <set_ts_storage_record+0xa9>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ts_storage_record>:
movq   $0x0,0x18(%rsi)
movdqu (%rcx),%xmm0
movdqa 0xeec(%rip),%xmm1
pand   %xmm0,%xmm1
por    0xef0(%rip),%xmm1
psrlq  $0x20,%xmm0
por    0xef3(%rip),%xmm0
subpd  0xefb(%rip),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm0,(%rsi)
mov    0x10(%rcx),%rax
movq   %rax,%xmm2
punpckldq 0xef2(%rip),%xmm2
subpd  0xefa(%rip),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsi)
test   %rax,%rax
je     1179 <set_ts_storage_record+0x79>
unpckhpd %xmm0,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsi)
ret

LLVM IR (-O0):
%struct.module = type opaque
define void @set_ts_storage_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
%12 = load double*, double** %7
%13 = getelementptr inbounds double, double* %12, i64 3
store double 0.000000e+00, double* %13
store i32 0, i32* %11
br label %14
14: ; preds = %28, %5
%15 = load i32, i32* %11
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = load i64*, i64** %9
%19 = load i32, i32* %11
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i64, i64* %18, i64 %20
%22 = load i64, i64* %21
%23 = uitofp i64 %22 to double
%24 = load double*, double** %7
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %17
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
br label %14
31: ; preds = %14
%32 = load i64*, i64** %9
%33 = getelementptr inbounds i64, i64* %32, i64 2
%34 = load i64, i64* %33
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %31
%37 = load double*, double** %7
%38 = getelementptr inbounds double, double* %37, i64 1
%39 = load double, double* %38
%40 = load double*, double** %7
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = fdiv double %39, %42
%44 = load double*, double** %7
%45 = getelementptr inbounds double, double* %44, i64 3
store double %43, double* %45
br label %46
46: ; preds = %36, %31
ret void
}

LLVM IR (-O2):
%struct.module = type opaque
define void @set_ts_storage_record(%struct.module* nocapture readnone %0, double* nocapture %1, i64* nocapture readnone %2, i64* nocapture %3, i32 %4) {
%6 = getelementptr inbounds double, double* %1, i64 3
store double 0.000000e+00, double* %6
%7 = bitcast i64* %3 to <2 x i64>*
%8 = load <2 x i64>, <2 x i64>* %7
%9 = uitofp <2 x i64> %8 to <2 x double>
%10 = bitcast double* %1 to <2 x double>*
store <2 x double> %9, <2 x double>* %10
%11 = getelementptr inbounds i64, i64* %3, i64 2
%12 = load i64, i64* %11
%13 = uitofp i64 %12 to double
%14 = getelementptr inbounds double, double* %1, i64 2
store double %13, double* %14
%15 = icmp eq i64 %12, 0
br i1 %15, label %19, label %16
16: ; preds = %5
%17 = extractelement <2 x double> %9, i64 1
%18 = fdiv double %17, %13
store double %18, double* %6
br label %19
19: ; preds = %16, %5
ret void
}