#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 */
scalar_t__ mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
void createTable(MYSQL *connection, char *tableName) {
  char query[500];
  sprintf(query,
          "create table benchmark.%s ("
          "id INT(11) not null auto_increment,"
          "name varchar(100) not null,"
          "email varchar(100) not null,"
          "password varchar(100) not null,"
          "text longtext not null,"
          "hmac blob,"
          "history blob,"
          "primary key (id)"
          ");",
          tableName);
  if (mysql_query(connection, query)) {
    char dropQuery[500];
    sprintf(dropQuery, "drop table benchmark.%s;", tableName);
    mysql_query(connection, dropQuery);
    mysql_query(connection, query);
  }
}


x86 assembly (clang, -O0):
<createTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebb(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <mysql_query@plt>
cmp    $0x0,%rax
je     119b <createTable+0x7b>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xf5f(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <mysql_query@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <mysql_query@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createTable>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec7(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <mysql_query@plt>
test   %rax,%rax
je     1187 <createTable+0x67>
lea    0xf77(%rip),%rsi
lea    0x200(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <mysql_query@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <mysql_query@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [213 x i8] c"create table benchmark.%s (id INT(11) not null auto_increment,name varchar(100) not null,email varchar(100) not null,password varchar(100) not null,text longtext not null,hmac blob,history blob,primary key (id));\00"
@.str.1 = [25 x i8] c"drop table benchmark.%s;\00"
define void @createTable(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [500 x i8]
%6 = alloca [500 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([213 x i8], [213 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32*, i32** %3
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%12 = call i64 @mysql_query(i32* %10, i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %3
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%20 = call i64 @mysql_query(i32* %18, i8* %19)
%21 = load i32*, i32** %3
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%23 = call i64 @mysql_query(i32* %21, i8* %22)
br label %24
24: ; preds = %14, %2
ret void
}

LLVM IR (-O2):
@.str = [213 x i8] c"create table benchmark.%s (id INT(11) not null auto_increment,name varchar(100) not null,email varchar(100) not null,password varchar(100) not null,text longtext not null,hmac blob,history blob,primary key (id));\00"
@.str.1 = [25 x i8] c"drop table benchmark.%s;\00"
define void @createTable(i32* %0, i8* %1) {
%3 = alloca [500 x i8]
%4 = alloca [500 x i8]
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([213 x i8], [213 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = call i64 @mysql_query(i32* %0, i8* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%11 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%12 = call i64 @mysql_query(i32* %0, i8* %10)
%13 = call i64 @mysql_query(i32* %0, i8* %5)
br label %14
14: ; preds = %9, %2
ret void
}