#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*/ exit(int);
int /*<<< orphan*/ log_printf(char *, int, char const *, ...);
void log_assert(int expr, int line, const char *file, char *msg) {
  if (expr)
    return;
  if (NULL != msg)
    log_printf("ASSERT: line %d of %s, %s\n", line, file, msg);
  else
    log_printf("ASSERT: line %d of %s\n", line, file);
  exit(-1);
}


x86 assembly (clang, -O0):
<log_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <log_assert+0x26>
add    $0x20,%rsp
pop    %rbp
ret
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1170 <log_assert+0x50>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <log_printf@plt>
jmp    1185 <log_assert+0x65>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <log_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<log_assert>:
test   %edi,%edi
je     1125 <log_assert+0x5>
ret
push   %rax
test   %rcx,%rcx
jne    1143 <log_assert+0x23>
lea    0xee9(%rip),%rdi
xor    %eax,%eax
call   1030 <log_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <log_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"ASSERT: line %d of %s, %s\0A\00"
@.str.1 = [23 x i8] c"ASSERT: line %d of %s\0A\00"
define void @log_assert(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %4
ret void
12: ; preds = %4
%13 = load i8*, i8** %8
%14 = icmp ne i8* null, %13
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i8*, i8** %7
%18 = load i8*, i8** %8
%19 = call i32 (i8*, i32, i8*, ...) @log_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %17, i8* %18)
br label %24
20: ; preds = %12
%21 = load i32, i32* %6
%22 = load i8*, i8** %7
%23 = call i32 (i8*, i32, i8*, ...) @log_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %22)
br label %24
24: ; preds = %20, %15
%25 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"ASSERT: line %d of %s, %s\0A\00"
@.str.1 = [23 x i8] c"ASSERT: line %d of %s\0A\00"
define void @log_assert(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %7, label %6
6: ; preds = %4
ret void
7: ; preds = %4
%8 = icmp eq i8* %3, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 (i8*, i32, i8*, ...) @log_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2, i8* %3)
br label %13
11: ; preds = %7
%12 = tail call i32 (i8*, i32, i8*, ...) @log_printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
br label %13
13: ; preds = %11, %9
%14 = tail call i32 @exit(i32 -1)
unreachable
}