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

/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *,
                            int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void __bad_assert(const char *file, int line, const char *expr) {
  char buf[256];
  snprintf(buf, sizeof(buf), "Assertion failed: %s (%s line %d)\n", expr, file,
           line);
  write(STDERR_FILENO, buf, strlen(buf));
  abort();
}


x86 assembly (clang, -O0):
<__bad_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0xc(%rbp),%r9d
mov    $0x100,%esi
lea    0xe8b(%rip),%rdx
call   1060 <snprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x12c(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x128(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x12c(%rbp),%edi
mov    -0x128(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<__bad_assert>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%rcx
mov    %esi,%r9d
mov    %rdi,%r8
lea    0xea7(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <snprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Assertion failed: %s (%s line %d)\0A\00"
@STDERR_FILENO = global i32 0
define void @__bad_assert(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [256 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %6
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = call i32 @snprintf(i8* %8, i32 256, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i32 %11)
%13 = load i32, i32* @STDERR_FILENO
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @write(i32 %13, i8* %14, i32 %16)
%18 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [35 x i8] c"Assertion failed: %s (%s line %d)\0A\00"
@STDERR_FILENO = global i32 0
define void @__bad_assert(i8* %0, i32 %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 256, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i32 %1)
%7 = load i32, i32* @STDERR_FILENO
%8 = call i32 @strlen(i8* %5)
%9 = call i32 @write(i32 %7, i8* %5, i32 %8)
%10 = call i32 (...) @abort()
unreachable
}