void set_swift_swapdir_record(struct module *mod, double st_array[],
                              unsigned long long pre_array[],
                              unsigned long long cur_array[], int inter) {
  st_array[0] = cur_array[0];
  st_array[1] = cur_array[1];
  st_array[2] = cur_array[2];
  st_array[3] = cur_array[3];
  st_array[4] = cur_array[4];
  if (cur_array[5] - pre_array[5] <= 0) {
    st_array[5] = -1;
  } else {
    st_array[5] = 100 * inter / (cur_array[5] - pre_array[5]);
  }
}


x86 assembly (clang, -O0):
<set_swift_swapdir_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    -0x20(%rbp),%rax
movq   (%rax),%xmm0
movaps 0xed9(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xedd(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movq   0x8(%rax),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movq   0x10(%rax),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
movq   0x18(%rax),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x20(%rbp),%rax
movq   0x20(%rax),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rax
mov    -0x18(%rbp),%rcx
sub    0x28(%rcx),%rax
cmp    $0x0,%rax
ja     120e <set_swift_swapdir_record+0x10e>
mov    -0x10(%rbp),%rax
movsd  0xe1c(%rip),%xmm0
movsd  %xmm0,0x28(%rax)
jmp    125e <set_swift_swapdir_record+0x15e>
mov    -0x24(%rbp),%eax
imul   $0x64,%eax,%eax
cltq
mov    -0x20(%rbp),%rcx
mov    0x28(%rcx),%rcx
mov    -0x18(%rbp),%rdx
mov    0x28(%rdx),%rdx
sub    %rdx,%rcx
xor    %edx,%edx
div    %rcx
movq   %rax,%xmm0
movaps 0xdc6(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xdca(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_swift_swapdir_record>:
movdqu (%rcx),%xmm0
movdqa 0xef4(%rip),%xmm1
movdqa %xmm0,%xmm2
pand   %xmm1,%xmm2
movdqa 0xef4(%rip),%xmm3
por    %xmm3,%xmm2
psrlq  $0x20,%xmm0
movdqa 0xef3(%rip),%xmm4
por    %xmm4,%xmm0
movapd 0xef7(%rip),%xmm5
subpd  %xmm5,%xmm0
addpd  %xmm2,%xmm0
movupd %xmm0,(%rsi)
movdqu 0x10(%rcx),%xmm0
pand   %xmm0,%xmm1
por    %xmm3,%xmm1
psrlq  $0x20,%xmm0
por    %xmm4,%xmm0
subpd  %xmm5,%xmm0
addpd  %xmm1,%xmm0
movupd %xmm0,0x10(%rsi)
movsd  0x20(%rcx),%xmm0
unpcklps 0xecc(%rip),%xmm0
subpd  0xed4(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsi)
mov    0x28(%rcx),%rdi
sub    0x28(%rdx),%rdi
je     11b4 <set_swift_swapdir_record+0xb4>
imul   $0x64,%r8d,%eax
movslq %eax,%rcx
mov    %rcx,%rdx
or     %rdi,%rdx
shr    $0x20,%rdx
je     11c2 <set_swift_swapdir_record+0xc2>
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
jmp    11c6 <set_swift_swapdir_record+0xc6>
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,0x28(%rsi)
ret
xor    %edx,%edx
div    %edi
movq   %rax,%xmm1
punpckldq 0xe6d(%rip),%xmm1
subpd  0xe75(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsi)
ret

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

LLVM IR (-O2):
%struct.module = type opaque
define void @set_swift_swapdir_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 = getelementptr inbounds double, double* %1, i64 2
%12 = bitcast i64* %10 to <2 x i64>*
%13 = load <2 x i64>, <2 x i64>* %12
%14 = uitofp <2 x i64> %13 to <2 x double>
%15 = bitcast double* %11 to <2 x double>*
store <2 x double> %14, <2 x double>* %15
%16 = getelementptr inbounds i64, i64* %3, i64 4
%17 = load i64, i64* %16
%18 = uitofp i64 %17 to double
%19 = getelementptr inbounds double, double* %1, i64 4
store double %18, double* %19
%20 = getelementptr inbounds i64, i64* %3, i64 5
%21 = load i64, i64* %20
%22 = getelementptr inbounds i64, i64* %2, i64 5
%23 = load i64, i64* %22
%24 = sub i64 %21, %23
%25 = icmp eq i64 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %5
%27 = mul nsw i32 %4, 100
%28 = sext i32 %27 to i64
%29 = udiv i64 %28, %24
%30 = uitofp i64 %29 to double
br label %31
31: ; preds = %5, %26
%32 = phi double [ %30, %26 ], [ -1.000000e+00, %5 ]
%33 = getelementptr inbounds double, double* %1, i64 5
store double %32, double* %33
ret void
}