#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*/ msg;

/* Variables and functions */
int /*<<< orphan*/ __assert(char *, char const *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char *);
char *strerror(int /*<<< orphan*/);
void __assertok_fail(const char *expr, const char *file, int line,
                     const char *function) {
  char msg[120];
  snprintf(msg, sizeof(msg), "%s (errno=\"%s\")", expr, strerror(errno));
  __assert(msg, file, line);
}


x86 assembly (clang, -O0):
<__assertok_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rcx
mov    %rax,%r8
mov    $0x78,%esi
lea    0xe72(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <__assert@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__assertok_fail>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea8(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x78,%esi
mov    %rbp,%rcx
mov    %rax,%r8
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <__assert@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%s (errno=\22%s\22)\00"
@errno = global i32 0
define void @__assertok_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [120 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [120 x i8], [120 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 @snprintf(i8* %10, i32 120, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %13)
%15 = getelementptr inbounds [120 x i8], [120 x i8]* %9, i64 0, i64 0
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = call i32 @__assert(i8* %15, i8* %16, i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s (errno=\22%s\22)\00"
@errno = global i32 0
define void @__assertok_fail(i8* %0, i8* %1, i32 %2, i8* nocapture readnone %3) {
%5 = alloca [120 x i8]
%6 = getelementptr inbounds [120 x i8], [120 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = call i32 @snprintf(i8* %6, i32 120, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %8)
%10 = call i32 @__assert(i8* %6, i8* %1, i32 %2)
ret void
}