#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 inverse(double *, double *, double const);
int /*<<< orphan*/ mv_mul(double *, double *, double *);
int cal_p0(double **p, double **r, double *b, const int n, const double eps) {
  double t[4], s[2];
  if (inverse(t, r[0], eps) == -1)
    return (-1);
  s[0] = b[0];
  s[1] = b[n - 1];
  mv_mul(p[0], t, s);
  return (0);
}


x86 assembly (clang, -O0):
<cal_p0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
movsd  -0x30(%rbp),%xmm0
call   1040 <inverse@plt>
cmp    $0xffffffff,%eax
jne    1166 <cal_p0+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a5 <cal_p0+0x85>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1030 <mv_mul@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_p0>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    (%rsi),%rsi
lea    0x10(%rsp),%rdi
call   1040 <inverse@plt>
cmp    $0xffffffff,%eax
je     116e <cal_p0+0x4e>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
movslq %ebp,%rax
movsd  -0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    (%r14),%rdi
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <mv_mul@plt>
xor    %eax,%eax
jmp    1173 <cal_p0+0x53>
mov    $0xffffffff,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cal_p0(double** %0, double** %1, double* %2, i32 %3, double %4) {
%6 = alloca i32
%7 = alloca double**
%8 = alloca double**
%9 = alloca double*
%10 = alloca i32
%11 = alloca double
%12 = alloca [4 x double]
%13 = alloca [2 x double]
store double** %0, double*** %7
store double** %1, double*** %8
store double* %2, double** %9
store i32 %3, i32* %10
store double %4, double* %11
%14 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%15 = load double**, double*** %8
%16 = getelementptr inbounds double*, double** %15, i64 0
%17 = load double*, double** %16
%18 = load double, double* %11
%19 = call i32 @inverse(double* %14, double* %17, double %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %5
store i32 -1, i32* %6
br label %40
22: ; preds = %5
%23 = load double*, double** %9
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
store double %25, double* %26
%27 = load double*, double** %9
%28 = load i32, i32* %10
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %27, i64 %30
%32 = load double, double* %31
%33 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 1
store double %32, double* %33
%34 = load double**, double*** %7
%35 = getelementptr inbounds double*, double** %34, i64 0
%36 = load double*, double** %35
%37 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%38 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%39 = call i32 @mv_mul(double* %36, double* %37, double* %38)
store i32 0, i32* %6
br label %40
40: ; preds = %22, %21
%41 = load i32, i32* %6
ret i32 %41
}

LLVM IR (-O2):
define i32 @cal_p0(double** nocapture %0, double** nocapture %1, double* nocapture %2, i32 %3, double %4) {
%6 = alloca [4 x double]
%7 = alloca [2 x double]
%8 = bitcast [4 x double]* %6 to i8*
%9 = bitcast [2 x double]* %7 to i8*
%10 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%11 = load double*, double** %1
%12 = call i32 @inverse(double* %10, double* %11, double %4)
%13 = icmp eq i32 %12, -1
br i1 %13, label %24, label %14
14: ; preds = %5
%15 = load double, double* %2
%16 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
store double %15, double* %16
%17 = add nsw i32 %3, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %2, i64 %18
%20 = load double, double* %19
%21 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 1
store double %20, double* %21
%22 = load double*, double** %0
%23 = call i32 @mv_mul(double* %22, double* %10, double* %16)
br label %24
24: ; preds = %5, %14
%25 = phi i32 [ 0, %14 ], [ -1, %5 ]
ret i32 %25
}