#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*/ LOG_EMERG;
scalar_t__ __get_logopt();
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char const *, int,
                          char const *);
void assfail(const char *msg, const char *file, int line) {
  if (__get_logopt()) {
    syslog(LOG_EMERG, "Assertion failed %s/%d: %s", file, line, msg);
  } else {
    fprintf(stderr, "Assertion failed in file %s, line %d\n", file, line);
    fprintf(stderr, "Fatal error: %s\n", msg);
  }
  abort();
}


x86 assembly (clang, -O0):
<assfail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <__get_logopt@plt>
cmp    $0x0,%rax
je     1189 <assfail+0x49>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xe81(%rip),%rsi
call   1060 <syslog@plt>
jmp    11c2 <assfail+0x82>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<assfail>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <__get_logopt@plt>
test   %rax,%rax
jne    1193 <assfail+0x53>
mov    0x2e76(%rip),%r15
mov    (%r15),%edi
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xebf(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %r14,%r8
call   1060 <syslog@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@LOG_EMERG = global i32 0
@.str = [27 x i8] c"Assertion failed %s/%d: %s\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"Assertion failed in file %s, line %d\0A\00"
@.str.2 = [17 x i8] c"Fatal error: %s\0A\00"
define void @assfail(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i64 (...) @__get_logopt()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i32, i32* @LOG_EMERG
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = load i8*, i8** %4
%14 = call i32 @syslog(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12, i8* %13)
br label %23
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %5
%18 = load i32, i32* %6
%19 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %18)
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %4
%22 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %15, %9
%24 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@LOG_EMERG = global i32 0
@.str = [27 x i8] c"Assertion failed %s/%d: %s\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"Assertion failed in file %s, line %d\0A\00"
@.str.2 = [17 x i8] c"Fatal error: %s\0A\00"
define void @assfail(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 (...) @__get_logopt()
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* @LOG_EMERG
%8 = tail call i32 @syslog(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
br label %14
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %14
14: ; preds = %9, %6
%15 = tail call i32 (...) @abort()
unreachable
}