#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*/ DymosimError(char *);
int /*<<< orphan*/ DymosimMessage(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *, char const *,
                           char const *, double, double);
void SolveScalarError(const char *xs, const char *bs, const char *As,
                      double bval_, double Aval_, int alwaysError) {
  char s[1000];
  sprintf(s, "Error: %s for %.400s = (%.200s)/(%.200s) = %g/%g",
          (alwaysError & 1) ? "Scalar system is always singular, it may be "
                              "possible to evaluate parameters to avoid this,"
                            : "Singular inconsistent scalar system",
          xs, bs, As, bval_, Aval_);
  if (alwaysError & 2)
    DymosimError(s);
  else
    DymosimMessage(s);
}


x86 assembly (clang, -O0):
<SolveScalarError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
and    $0x1,%ecx
lea    0xf24(%rip),%rdx
lea    0xec2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe6d(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x2c(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11b8 <SolveScalarError+0x88>
lea    -0x420(%rbp),%rdi
call   1040 <DymosimError@plt>
jmp    11c4 <SolveScalarError+0x94>
lea    -0x420(%rbp),%rdi
call   1030 <DymosimMessage@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SolveScalarError>:
push   %rbx
sub    $0x3f0,%rsp
mov    %ecx,%ebx
mov    %rdx,%r9
mov    %rsi,%r8
mov    %rdi,%rcx
test   $0x1,%bl
lea    0xf3f(%rip),%rax
lea    0xedd(%rip),%rdx
cmove  %rax,%rdx
lea    0xea1(%rip),%rsi
mov    %rsp,%rdi
call   1050 <sprintf@plt>
mov    %rsp,%rdi
test   $0x2,%bl
jne    1176 <SolveScalarError+0x46>
call   1030 <DymosimMessage@plt>
jmp    117b <SolveScalarError+0x4b>
call   1040 <DymosimError@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Error: %s for %.400s = (%.200s)/(%.200s) = %g/%g\00"
@.str.1 = [91 x i8] c"Scalar system is always singular, it may be possible to evaluate parameters to avoid this,\00"
@.str.2 = [36 x i8] c"Singular inconsistent scalar system\00"
define void @SolveScalarError(i8* %0, i8* %1, i8* %2, double %3, double %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca [1000 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store double %3, double* %10
store double %4, double* %11
store i32 %5, i32* %12
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%15 = load i32, i32* %12
%16 = and i32 %15, 1
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %8
%22 = load i8*, i8** %9
%23 = load double, double* %10
%24 = load double, double* %11
%25 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i8* %22, double %23, double %24)
%26 = load i32, i32* %12
%27 = and i32 %26, 2
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %6
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%31 = call i32 @DymosimError(i8* %30)
br label %35
32: ; preds = %6
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%34 = call i32 @DymosimMessage(i8* %33)
br label %35
35: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"Error: %s for %.400s = (%.200s)/(%.200s) = %g/%g\00"
@.str.1 = [91 x i8] c"Scalar system is always singular, it may be possible to evaluate parameters to avoid this,\00"
@.str.2 = [36 x i8] c"Singular inconsistent scalar system\00"
define void @SolveScalarError(i8* %0, i8* %1, i8* %2, double %3, double %4, i32 %5) {
%7 = alloca [1000 x i8]
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%9 = and i32 %5, 1
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.1, i64 0, i64 0)
%12 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %0, i8* %1, i8* %2, double %3, double %4)
%13 = and i32 %5, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %6
%16 = call i32 @DymosimError(i8* %8)
br label %19
17: ; preds = %6
%18 = call i32 @DymosimMessage(i8* %8)
br label %19
19: ; preds = %17, %15
ret void
}