#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 inverse(double *, double *, double const);
int /*<<< orphan*/ mm_mul(double *, double *, double *);
int cal_bx(double *bx, double *vx, double *ex, const double eps) {
  double t[4], s[4];
  crstrns(t, vx);
  if (inverse(s, t, eps) == -1)
    return (-1);
  mm_mul(bx, s, ex);
  return (0);
}


x86 assembly (clang, -O0):
<cal_bx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <crstrns@plt>
lea    -0x70(%rbp),%rdi
lea    -0x50(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
call   1040 <inverse@plt>
cmp    $0xffffffff,%eax
jne    117d <cal_bx+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <cal_bx+0x65>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <mm_mul@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_bx>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdx,%r14
mov    %rdi,%r15
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <crstrns@plt>
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
movsd  0x8(%rsp),%xmm0
call   1040 <inverse@plt>
cmp    $0xffffffff,%eax
je     117e <cal_bx+0x4e>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <mm_mul@plt>
xor    %eax,%eax
jmp    1183 <cal_bx+0x53>
mov    $0xffffffff,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cal_bx(double* %0, double* %1, double* %2, double %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca [4 x double]
%11 = alloca [4 x double]
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double %3, double* %9
%12 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%13 = load double*, double** %7
%14 = call i32 @crstrns(double* %12, double* %13)
%15 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%16 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%17 = load double, double* %9
%18 = call i32 @inverse(double* %15, double* %16, double %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %4
store i32 -1, i32* %5
br label %26
21: ; preds = %4
%22 = load double*, double** %6
%23 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%24 = load double*, double** %8
%25 = call i32 @mm_mul(double* %22, double* %23, double* %24)
store i32 0, i32* %5
br label %26
26: ; preds = %21, %20
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @cal_bx(double* %0, double* %1, double* %2, double %3) {
%5 = alloca [4 x double]
%6 = alloca [4 x double]
%7 = bitcast [4 x double]* %5 to i8*
%8 = bitcast [4 x double]* %6 to i8*
%9 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%10 = call i32 @crstrns(double* %9, double* %1)
%11 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%12 = call i32 @inverse(double* %11, double* %9, double %3)
%13 = icmp eq i32 %12, -1
br i1 %13, label %16, label %14
14: ; preds = %4
%15 = call i32 @mm_mul(double* %0, double* %11, double* %2)
br label %16
16: ; preds = %4, %14
%17 = phi i32 [ 0, %14 ], [ -1, %4 ]
ret i32 %17
}