#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;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void lib765_default_error_function(int debuglevel, char *fmt, va_list ap) {
  if (debuglevel > 1)
    return;
  fprintf(stderr, "lib765 level:%d error: ", debuglevel);
  vfprintf(stderr, fmt, ap);
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<lib765_default_error_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1141 <lib765_default_error_function+0x21>
jmp    1187 <lib765_default_error_function+0x67>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <vfprintf@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib765_default_error_function>:
cmp    $0x1,%edi
jle    1126 <lib765_default_error_function+0x6>
ret
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%edx
mov    0x2ea8(%rip),%r14
mov    (%r14),%edi
lea    0xebe(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <vfprintf@plt>
mov    (%r14),%edi
lea    0xeb8(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"lib765 level:%d error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @lib765_default_error_function(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %3
br label %20
10: ; preds = %3
%11 = load i32, i32* @stderr
%12 = load i32, i32* %4
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = call i32 @vfprintf(i32 %14, i8* %15, i32 %16)
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"lib765 level:%d error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @lib765_default_error_function(i32 %0, i8* %1, i32 %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
%8 = load i32, i32* @stderr
%9 = tail call i32 @vfprintf(i32 %8, i8* %1, i32 %2)
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %3, %5
ret void
}