#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/ *, char const *,
                            int /*<<< orphan*/);
void __simple_log(FILE *file, const char *tag, const char *format,
                  va_list *args) {
  assert(file && tag && format && args);
  fputc('[', file);
  fputs(tag, file);
  fputc(']', file);
  fputc(' ', file);
  vfprintf(file, format, *args);
}


x86 assembly (clang, -O0):
<__simple_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x21(%rbp)
je     1193 <__simple_log+0x53>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     1193 <__simple_log+0x53>
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x21(%rbp)
je     1193 <__simple_log+0x53>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rsi
mov    $0x5b,%edi
call   1040 <fputc@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rsi
mov    $0x5d,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0x20,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
call   1060 <vfprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__simple_log>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
test   %rdx,%rdx
setne  %al
test   %r15,%r15
setne  %dl
and    %al,%dl
and    %cl,%dl
movzbl %dl,%edi
call   1050 <assert@plt>
mov    $0x5b,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    $0x5d,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <vfprintf@plt>

LLVM IR (-O0):
define void @__simple_log(i32* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %20
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32*, i32** %8
%19 = icmp ne i32* %18, null
br label %20
20: ; preds = %17, %14, %11, %4
%21 = phi i1 [ false, %14 ], [ false, %11 ], [ false, %4 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i32*, i32** %5
%25 = call i32 @fputc(i8 signext 91, i32* %24)
%26 = load i8*, i8** %6
%27 = load i32*, i32** %5
%28 = call i32 @fputs(i8* %26, i32* %27)
%29 = load i32*, i32** %5
%30 = call i32 @fputc(i8 signext 93, i32* %29)
%31 = load i32*, i32** %5
%32 = call i32 @fputc(i8 signext 32, i32* %31)
%33 = load i32*, i32** %5
%34 = load i8*, i8** %7
%35 = load i32*, i32** %8
%36 = load i32, i32* %35
%37 = call i32 @vfprintf(i32* %33, i8* %34, i32 %36)
ret void
}

LLVM IR (-O2):
define void @__simple_log(i32* %0, i8* %1, i8* %2, i32* %3) {
%5 = icmp ne i32* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
%8 = icmp ne i8* %2, null
%9 = and i1 %7, %8
%10 = icmp ne i32* %3, null
%11 = and i1 %9, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @fputc(i8 signext 91, i32* %0)
%15 = tail call i32 @fputs(i8* %1, i32* %0)
%16 = tail call i32 @fputc(i8 signext 93, i32* %0)
%17 = tail call i32 @fputc(i8 signext 32, i32* %0)
%18 = load i32, i32* %3
%19 = tail call i32 @vfprintf(i32* %0, i8* %2, i32 %18)
ret void
}