#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 mysql_errno(int /*<<< orphan*/ *);
char *mysql_error(int /*<<< orphan*/ *);
scalar_t__ mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, int, char *);
void createDefaultTable(MYSQL *connection) {
  char *defaultTableQuery = "create table benchmark.user ("
                            "id INT(11) not null auto_increment,"
                            "name varchar(100) not null,"
                            "email varchar(100) not null,"
                            "password varchar(100) not null,"
                            "hmac blob,"
                            "history blob,"
                            "primary key (id)"
                            ");";
  if (mysql_query(connection, defaultTableQuery)) {
    printf("createDefaultTable::Error %u: %s\n", mysql_errno(connection),
           mysql_error(connection));
  }
}


x86 assembly (clang, -O0):
<createDefaultTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <mysql_query@plt>
cmp    $0x0,%rax
je     1195 <createDefaultTable+0x55>
mov    -0x8(%rbp),%rdi
call   1050 <mysql_errno@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mysql_error@plt>
mov    -0x14(%rbp),%esi
mov    %rax,%rdx
lea    0xf30(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createDefaultTable>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rsi
call   1030 <mysql_query@plt>
test   %rax,%rax
je     1180 <createDefaultTable+0x40>
mov    %rbx,%rdi
call   1050 <mysql_errno@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <mysql_error@plt>
lea    0xf50(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [192 x i8] c"create table benchmark.user (id INT(11) not null auto_increment,name varchar(100) not null,email varchar(100) not null,password varchar(100) not null,hmac blob,history blob,primary key (id));\00"
@.str.1 = [34 x i8] c"createDefaultTable::Error %u: %s\0A\00"
define void @createDefaultTable(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
store i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32*, i32** %2
%5 = load i8*, i8** %3
%6 = call i64 @mysql_query(i32* %4, i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32*, i32** %2
%10 = call i32 @mysql_errno(i32* %9)
%11 = load i32*, i32** %2
%12 = call i8* @mysql_error(i32* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %10, i8* %12)
br label %14
14: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [192 x i8] c"create table benchmark.user (id INT(11) not null auto_increment,name varchar(100) not null,email varchar(100) not null,password varchar(100) not null,hmac blob,history blob,primary key (id));\00"
@.str.1 = [34 x i8] c"createDefaultTable::Error %u: %s\0A\00"
define void @createDefaultTable(i32* %0) {
%2 = tail call i64 @mysql_query(i32* %0, i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, 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 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
br label %8
8: ; preds = %4, %1
ret void
}