#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_ROW;
typedef int /*<<< orphan*/ MYSQL_RES;
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ *mysql_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ mysql_real_connect(int /*<<< orphan*/ *, char *, char *,
                                      char *, char *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void insertar_nvo_cliente(char *nombre) {
  MYSQL *conexion;
  MYSQL_RES *R;
  MYSQL_ROW COL;
  char *servidor = "localhost";
  char *usuario = "root";
  char *pass = "1234";
  char *base = "casaempenio";
  conexion = mysql_init(NULL);
  mysql_real_connect(conexion, servidor, usuario, pass, base, 0, NULL, 0);
  char *sentencia = "insert into clientes(nombre) values(";
  char buffer[500];
  sprintf(buffer, "%s'%s'); ", sentencia, nombre);
  mysql_query(conexion, buffer);
  mysql_close(conexion);
}


x86 assembly (clang, -O0):
<insertar_nvo_cliente>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <mysql_init@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
xor    %r9d,%r9d
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <mysql_real_connect@plt>
lea    0xe53(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x240(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe5e(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x240(%rbp),%rsi
call   1030 <mysql_query@plt>
mov    -0x10(%rbp),%rdi
call   1050 <mysql_close@plt>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertar_nvo_cliente>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%r14
xor    %edi,%edi
call   1060 <mysql_init@plt>
mov    %rax,%rbx
lea    0xe90(%rip),%rsi
lea    0xe93(%rip),%rdx
lea    0xe91(%rip),%rcx
lea    0xe8f(%rip),%r8
mov    %rax,%rdi
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1040 <mysql_real_connect@plt>
add    $0x10,%rsp
lea    0xea6(%rip),%rsi
lea    0xe7a(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rcx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <mysql_query@plt>
mov    %rbx,%rdi
call   1050 <mysql_close@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"root\00"
@.str.2 = [5 x i8] c"1234\00"
@.str.3 = [12 x i8] c"casaempenio\00"
@.str.4 = [37 x i8] c"insert into clientes(nombre) values(\00"
@.str.5 = [10 x i8] c"%s'%s'); \00"
define void @insertar_nvo_cliente(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [500 x i8]
store i8* %0, i8** %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %9
%12 = call i32* @mysql_init(i32* null)
store i32* %12, i32** %3
%13 = load i32*, i32** %3
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = load i8*, i8** %9
%18 = call i32 @mysql_real_connect(i32* %13, i8* %14, i8* %15, i8* %16, i8* %17, i32 0, i32* null, i32 0)
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8** %10
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %11, i64 0, i64 0
%20 = load i8*, i8** %10
%21 = load i8*, i8** %2
%22 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i32*, i32** %3
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %11, i64 0, i64 0
%25 = call i32 @mysql_query(i32* %23, i8* %24)
%26 = load i32*, i32** %3
%27 = call i32 @mysql_close(i32* %26)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"root\00"
@.str.2 = [5 x i8] c"1234\00"
@.str.3 = [12 x i8] c"casaempenio\00"
@.str.4 = [37 x i8] c"insert into clientes(nombre) values(\00"
@.str.5 = [10 x i8] c"%s'%s'); \00"
define void @insertar_nvo_cliente(i8* %0) {
%2 = alloca [500 x i8]
%3 = tail call i32* @mysql_init(i32* null)
%4 = tail call i32 @mysql_real_connect(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 0, i32* null, i32 0)
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%7 = call i32 @mysql_query(i32* %3, i8* %5)
%8 = call i32 @mysql_close(i32* %3)
ret void
}