#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*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, int);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
void assert_func(FILE *fp, char *file, int line, char *expression, char *fmt,
                 va_list ap) {
  fprintf(fp, "Assertion failure (%s) file..%s line..%d\n", expression, file,
          line);
  if (fmt) {
    vfprintf(fp, fmt, ap);
  }
}


x86 assembly (clang, -O0):
<assert_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
cmpq   $0x0,-0x28(%rbp)
je     1176 <assert_func+0x56>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <vfprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_func>:
push   %rbp
push   %r14
push   %rbx
mov    %r9d,%r14d
mov    %r8,%rbx
mov    %edx,%r8d
mov    %rsi,%rax
mov    %rdi,%rbp
lea    0xec6(%rip),%rsi
mov    %rcx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     115c <assert_func+0x3c>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <vfprintf@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [42 x i8] c"Assertion failure (%s) file..%s line..%d\0A\00"
define void @assert_func(i32* nocapture %0, i8* %1, i32 %2, i8* %3, i8* %4, i32 %5) {
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %1, i32 %2)
%8 = icmp eq i8* %4, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @vfprintf(i32* %0, i8* %4, i32 %5)
br label %11
11: ; preds = %9, %6
ret void
}