#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 */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, int, char *, char const *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void cdiAbortC_serial(const char *caller, const char *filename,
                      const char *functionname, int line,
                      const char *errorString, va_list ap) {
  fprintf(stderr, "ERROR, %s, %s, line %d%s%s\nerrorString: \"", functionname,
          filename, line, caller ? ", called from " : "", caller ? caller : "");
  vfprintf(stderr, errorString, ap);
  fputs("\"\n", stderr);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<cdiAbortC_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xeaf(%rip),%rax
lea    0xe97(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b7 <cdiAbortC_serial+0x77>
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    11c7 <cdiAbortC_serial+0x87>
lea    0xe7d(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    11c7 <cdiAbortC_serial+0x87>
mov    -0x38(%rbp),%r9
mov    -0x3c(%rbp),%r8d
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%rdx
mov    -0x54(%rbp),%edi
mov    -0x60(%rbp),%rax
lea    0xe1b(%rip),%rsi
mov    %rax,(%rsp)
call   1040 <fprintf@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%esi
lea    0xe26(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<cdiAbortC_serial>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r9d,%r14d
mov    %r8,%rbx
mov    %ecx,%r8d
mov    %rsi,%rcx
mov    0x2e85(%rip),%rbp
mov    0x0(%rbp),%eax
test   %rdi,%rdi
lea    0xed3(%rip),%rsi
lea    0xebb(%rip),%r9
cmove  %rsi,%r9
cmove  %rsi,%rdi
mov    %rdi,(%rsp)
lea    0xe7e(%rip),%rsi
mov    %eax,%edi
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"ERROR, %s, %s, line %d%s%s\0AerrorString: \22\00"
@.str.1 = [15 x i8] c", called from \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [3 x i8] c"\22\0A\00"
@EXIT_FAILURE = global i32 0
define void @cdiAbortC_serial(i8* %0, i8* %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %9
%15 = load i8*, i8** %8
%16 = load i32, i32* %10
%17 = load i8*, i8** %7
%18 = icmp ne i8* %17, null
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%21 = load i8*, i8** %7
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %6
%24 = load i8*, i8** %7
br label %26
25: ; preds = %6
br label %26
26: ; preds = %25, %23
%27 = phi i8* [ %24, %23 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %25 ]
%28 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i32 %16, i8* %20, i8* %27)
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %11
%31 = load i32, i32* %12
%32 = call i32 @vfprintf(i32 %29, i8* %30, i32 %31)
%33 = load i32, i32* @stderr
%34 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"ERROR, %s, %s, line %d%s%s\0AerrorString: \22\00"
@.str.1 = [15 x i8] c", called from \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [3 x i8] c"\22\0A\00"
@EXIT_FAILURE = global i32 0
define void @cdiAbortC_serial(i8* %0, i8* %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = load i32, i32* @stderr
%8 = icmp eq i8* %0, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%10 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %0
%11 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %1, i32 %3, i8* %9, i8* %10)
%12 = load i32, i32* @stderr
%13 = tail call i32 @vfprintf(i32 %12, i8* %4, i32 %5)
%14 = load i32, i32* @stderr
%15 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
}