#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 snprintf_ss(char *, size_t, char *, char const *, char const *, int, char *,
                char const *, char *);
int fmtassert(char *buf, size_t len, const char *file, int line,
              const char *function, const char *failedexpr) {
  return snprintf_ss(buf, len,
                     "assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
                     failedexpr, file, line, function ? ", function \"" : "",
                     function ? function : "", function ? "\"" : "");
}


x86 assembly (clang, -O0):
<fmtassert>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x88,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%rdx
lea    0xecc(%rip),%rax
lea    0xec6(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     118f <fmtassert+0x7f>
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    119f <fmtassert+0x8f>
lea    0xe9a(%rip),%rax
mov    %rax,-0x70(%rbp)
jmp    119f <fmtassert+0x8f>
mov    -0x40(%rbp),%r11
mov    -0x44(%rbp),%r9d
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%r10
mov    -0x30(%rbp),%rbx
lea    0xe6a(%rip),%rax
lea    0xe6f(%rip),%rdx
cmp    $0x0,%rbx
cmovne %rdx,%rax
lea    0xe24(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <snprintf_ss@plt>
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmtassert>:
push   %r14
push   %rbx
push   %rax
mov    %r8,%rax
test   %r8,%r8
lea    0xf0f(%rip),%r11
lea    0xf09(%rip),%r14
cmove  %r11,%r14
cmove  %r11,%rax
mov    %ecx,%r10d
mov    %rdx,%r8
lea    0xeff(%rip),%rbx
cmove  %r11,%rbx
sub    $0x8,%rsp
lea    0xeb4(%rip),%rdx
mov    %r9,%rcx
mov    %r10d,%r9d
push   %rbx
push   %rax
push   %r14
call   1030 <snprintf_ss@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [49 x i8] c"assertion \22%s\22 failed: file \22%s\22, line %d%s%s%s\0A\00"
@.str.1 = [13 x i8] c", function \22\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\22\00"
define i32 @fmtassert(i8* %0, i64 %1, i8* %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i64, i64* %8
%15 = load i8*, i8** %12
%16 = load i8*, i8** %9
%17 = load i32, i32* %10
%18 = load i8*, i8** %11
%19 = icmp ne i8* %18, null
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%22 = load i8*, i8** %11
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %6
%25 = load i8*, i8** %11
br label %27
26: ; preds = %6
br label %27
27: ; preds = %26, %24
%28 = phi i8* [ %25, %24 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %26 ]
%29 = load i8*, i8** %11
%30 = icmp ne i8* %29, null
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%33 = call i32 @snprintf_ss(i8* %13, i64 %14, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16, i32 %17, i8* %21, i8* %28, i8* %32)
ret i32 %33
}

LLVM IR (-O2):
@.str = [49 x i8] c"assertion \22%s\22 failed: file \22%s\22, line %d%s%s%s\0A\00"
@.str.1 = [13 x i8] c", function \22\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\22\00"
define i32 @fmtassert(i8* %0, i64 %1, i8* %2, i32 %3, i8* %4, i8* %5) {
%7 = icmp eq i8* %4, null
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0)
%9 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %4
%10 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%11 = tail call i32 @snprintf_ss(i8* %0, i64 %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %2, i32 %3, i8* %8, i8* %9, i8* %10)
ret i32 %11
}