#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 */
int /*<<< orphan*/ crstrns(double *, double *);
int /*<<< orphan*/ mm_mul(double *, double *, double *);
void cal_vx(double *vx, double *ex, double *bx) {
  double t[4], s[4];
  crstrns(t, ex);
  mm_mul(s, t, bx);
  vx[0] -= s[0];
  vx[1] -= s[1];
  vx[2] -= s[2];
  vx[3] -= s[3];
  return;
}


x86 assembly (clang, -O0):
<cal_vx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <crstrns@plt>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <mm_mul@plt>
movsd  -0x60(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x48(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_vx>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0x20(%rsp),%r15
mov    %r15,%rdi
call   1030 <crstrns@plt>
mov    %rsp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <mm_mul@plt>
movupd (%rbx),%xmm0
movupd 0x10(%rbx),%xmm1
subpd  (%rsp),%xmm0
movupd %xmm0,(%rbx)
subpd  0x10(%rsp),%xmm1
movupd %xmm1,0x10(%rbx)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @cal_vx(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [4 x double]
%8 = alloca [4 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%9 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%10 = load double*, double** %5
%11 = call i32 @crstrns(double* %9, double* %10)
%12 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%13 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%14 = load double*, double** %6
%15 = call i32 @mm_mul(double* %12, double* %13, double* %14)
%16 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = fsub double %20, %17
store double %21, double* %19
%22 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 1
%23 = load double, double* %22
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fsub double %26, %23
store double %27, double* %25
%28 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 2
%29 = load double, double* %28
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = fsub double %32, %29
store double %33, double* %31
%34 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 3
%35 = load double, double* %34
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 3
%38 = load double, double* %37
%39 = fsub double %38, %35
store double %39, double* %37
ret void
}

LLVM IR (-O2):
define void @cal_vx(double* nocapture %0, double* %1, double* %2) {
%4 = alloca [4 x double]
%5 = alloca [4 x double]
%6 = bitcast [4 x double]* %4 to i8*
%7 = bitcast [4 x double]* %5 to i8*
%8 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%9 = call i32 @crstrns(double* %8, double* %1)
%10 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%11 = call i32 @mm_mul(double* %10, double* %8, double* %2)
%12 = bitcast [4 x double]* %5 to <2 x double>*
%13 = load <2 x double>, <2 x double>* %12
%14 = bitcast double* %0 to <2 x double>*
%15 = load <2 x double>, <2 x double>* %14
%16 = fsub <2 x double> %15, %13
%17 = bitcast double* %0 to <2 x double>*
store <2 x double> %16, <2 x double>* %17
%18 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%19 = getelementptr inbounds double, double* %0, i64 2
%20 = bitcast double* %18 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = bitcast double* %19 to <2 x double>*
%23 = load <2 x double>, <2 x double>* %22
%24 = fsub <2 x double> %23, %21
%25 = bitcast double* %19 to <2 x double>*
store <2 x double> %24, <2 x double>* %25
ret void
}