#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*/ MYSQL;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int mysql_errno(int /*<<< orphan*/ *);
char *mysql_error(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void mysql_print_error(MYSQL *conn) {
  if (conn != NULL) {
    fprintf(stderr, "MySQL Error: %u : %s\n", mysql_errno(conn),
            mysql_error(conn));
  } else
    fprintf(stderr, "MySQL Error - No Handler\n");
}


x86 assembly (clang, -O0):
<mysql_print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1184 <mysql_print_error+0x54>
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mysql_errno@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mysql_error@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    %rax,%rcx
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    119b <mysql_print_error+0x6b>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysql_print_error>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%ebp
test   %rdi,%rdi
je     116f <mysql_print_error+0x3f>
mov    %rdi,%rbx
call   1030 <mysql_errno@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1050 <mysql_error@plt>
lea    0xea4(%rip),%rsi
mov    %ebp,%edi
mov    %r14d,%edx
mov    %rax,%rcx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>
lea    0xea0(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"MySQL Error: %u : %s\0A\00"
@.str.1 = [26 x i8] c"MySQL Error - No Handler\0A\00"
define void @mysql_print_error(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i32*, i32** %2
%8 = call i32 @mysql_errno(i32* %7)
%9 = load i32*, i32** %2
%10 = call i8* @mysql_error(i32* %9)
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %10)
br label %15
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"MySQL Error: %u : %s\0A\00"
@.str.1 = [26 x i8] c"MySQL Error - No Handler\0A\00"
define void @mysql_print_error(i32* %0) {
%2 = icmp eq i32* %0, null
%3 = load i32, i32* @stderr
br i1 %2, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @mysql_errno(i32* %0)
%6 = tail call i8* @mysql_error(i32* %0)
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %6)
br label %10
8: ; preds = %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
ret void
}