#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*/ _(char *);
int /*<<< orphan*/ __assert_fail_base(int /*<<< orphan*/, char *, char const *,
                                      unsigned int, char const *);
char *__strerror_r(int, char *, int);
void __assert_perror_fail(int errnum, const char *file, unsigned int line,
                          const char *function) {
  char errbuf[1024];
  char *e = __strerror_r(errnum, errbuf, sizeof errbuf);
  __assert_fail_base(_("%s%s%s:%u: %s%sUnexpected error: %s.\n"), e, file, line,
                     function);
}


x86 assembly (clang, -O0):
<__assert_perror_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1050 <__strerror_r@plt>
mov    %rax,-0x428(%rbp)
lea    0xe95(%rip),%rdi
call   1040 <_@plt>
mov    %eax,%edi
mov    -0x428(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1030 <__assert_fail_base@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__assert_perror_fail>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rsp,%rsi
mov    $0x400,%edx
call   1050 <__strerror_r@plt>
mov    %rax,%rbp
lea    0xea3(%rip),%rdi
call   1040 <_@plt>
mov    %eax,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r14,%r8
call   1030 <__assert_fail_base@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"%s%s%s:%u: %s%sUnexpected error: %s.\0A\00"
define void @__assert_perror_fail(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [1024 x i8]
%10 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%11 = load i32, i32* %5
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%13 = call i8* @__strerror_r(i32 %11, i8* %12, i32 1024)
store i8* %13, i8** %10
%14 = call i32 @_(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %10
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = load i8*, i8** %8
%19 = call i32 @__assert_fail_base(i32 %14, i8* %15, i8* %16, i32 %17, i8* %18)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"%s%s%s:%u: %s%sUnexpected error: %s.\0A\00"
define void @__assert_perror_fail(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i8* @__strerror_r(i32 %0, i8* %6, i32 1024)
%8 = call i32 @_(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @__assert_fail_base(i32 %8, i8* %7, i8* %1, i32 %2, i8* %3)
ret void
}