#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 *, char *, char *);
void modificar_cliente(char *nombre, char *nombre2) {
  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 = "update clientes set nombre=";
  char *sentencia2 = "WHERE nombre=";
  char buffer[500];
  sprintf(buffer, "%s '%s' %s '%s';", sentencia, nombre, sentencia2, nombre2);
  mysql_query(conexion, buffer);
  mysql_close(conexion);
}


x86 assembly (clang, -O0):
<modificar_cliente>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe96(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe95(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8f(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe89(%rip),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <mysql_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
xor    %r9d,%r9d
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <mysql_real_connect@plt>
lea    0xe4f(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x250(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xe4c(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x250(%rbp),%rsi
call   1030 <mysql_query@plt>
mov    -0x18(%rbp),%rdi
call   1050 <mysql_close@plt>
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modificar_cliente>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1f8,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
call   1060 <mysql_init@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%rsi
lea    0xe8e(%rip),%rdx
lea    0xe8c(%rip),%rcx
lea    0xe8a(%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    0xe75(%rip),%rdx
lea    0xe8a(%rip),%r8
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r15,%rcx
mov    %r14,%r9
call   1070 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <mysql_query@plt>
mov    %rbx,%rdi
call   1050 <mysql_close@plt>
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
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 = [28 x i8] c"update clientes set nombre=\00"
@.str.5 = [14 x i8] c"WHERE nombre=\00"
@.str.6 = [17 x i8] c"%s '%s' %s '%s';\00"
define void @modificar_cliente(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [500 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %11
%15 = call i32* @mysql_init(i32* null)
store i32* %15, i32** %5
%16 = load i32*, i32** %5
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = load i8*, i8** %10
%20 = load i8*, i8** %11
%21 = call i32 @mysql_real_connect(i32* %16, i8* %17, i8* %18, i8* %19, i8* %20, i32 0, i32* null, i32 0)
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8** %13
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %14, i64 0, i64 0
%23 = load i8*, i8** %12
%24 = load i8*, i8** %3
%25 = load i8*, i8** %13
%26 = load i8*, i8** %4
%27 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %23, i8* %24, i8* %25, i8* %26)
%28 = load i32*, i32** %5
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %14, i64 0, i64 0
%30 = call i32 @mysql_query(i32* %28, i8* %29)
%31 = load i32*, i32** %5
%32 = call i32 @mysql_close(i32* %31)
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 = [28 x i8] c"update clientes set nombre=\00"
@.str.5 = [14 x i8] c"WHERE nombre=\00"
@.str.6 = [17 x i8] c"%s '%s' %s '%s';\00"
define void @modificar_cliente(i8* %0, i8* %1) {
%3 = alloca [500 x i8]
%4 = tail call i32* @mysql_init(i32* null)
%5 = tail call i32 @mysql_real_connect(i32* %4, 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)
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%8 = call i32 @mysql_query(i32* %4, i8* %6)
%9 = call i32 @mysql_close(i32* %4)
ret void
}