#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void gnFail(const char *fname, const char *errmsg, const char *nptr,
            const char *usrmsg) {
  fprintf(stderr, "%s error", fname);
  if (usrmsg != NULL)
    fprintf(stderr, ": %s\n", usrmsg);
  fprintf(stderr, ": %s\n", errmsg);
  if (nptr != NULL && *nptr != '\0')
    fprintf(stderr, "        offending text: %s\n", nptr);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<gnFail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1175 <gnFail+0x55>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     11c2 <gnFail+0xa2>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c2 <gnFail+0xa2>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe4c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<gnFail>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rdx
mov    0x2ea5(%rip),%r12
mov    (%r12),%edi
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     1163 <gnFail+0x43>
mov    (%r12),%edi
lea    0xec4(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r12),%edi
lea    0xeb1(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
test   %r15,%r15
je     1194 <gnFail+0x74>
cmpb   $0x0,(%r15)
je     1194 <gnFail+0x74>
mov    (%r12),%edi
lea    0xe7d(%rip),%rsi
mov    %r15,%rdx
call   1030 <fprintf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"%s error\00"
@.str.1 = [6 x i8] c": %s\0A\00"
@.str.2 = [28 x i8] c" offending text: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @gnFail(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = icmp eq i8* %3, null
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %11
11: ; preds = %8, %4
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%14 = icmp eq i8* %2, null
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = load i8, i8* %2
%17 = icmp eq i8 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %21
21: ; preds = %18, %15, %11
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @exit(i32 %22)
unreachable
}