#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 */
struct sqlConnection {
  int dummy;
};
struct barChartData {
  int dummy;
};
typedef int /*<<< orphan*/ query;

/* Variables and functions */
struct barChartData *barChartDataLoadByQuery(struct sqlConnection *, char *);
int /*<<< orphan*/ sqlSafef(char *, int, char *, char *, char *);
struct barChartData *barChartDataLoadForLocus(struct sqlConnection *conn,
                                              char *table, char *locus) {
  char query[512];
  sqlSafef(query, sizeof(query), "SELECT * FROM %s WHERE locus='%s'", table,
           locus);
  return barChartDataLoadByQuery(conn, query);
}


x86 assembly (clang, -O0):
<barChartDataLoadForLocus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x200,%esi
lea    0xeae(%rip),%rdx
call   1030 <sqlSafef@plt>
mov    -0x8(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1040 <barChartDataLoadByQuery@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<barChartDataLoadForLocus>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xec6(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x200,%esi
call   1030 <sqlSafef@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <barChartDataLoadByQuery@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.barChartData = type { i32 }
%struct.sqlConnection = type { i32 }
@.str = [34 x i8] c"SELECT * FROM %s WHERE locus='%s'\00"
define %struct.barChartData* @barChartDataLoadForLocus(%struct.sqlConnection* %0, i8* %1, i8* %2) {
%4 = alloca %struct.sqlConnection*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [512 x i8]
store %struct.sqlConnection* %0, %struct.sqlConnection** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @sqlSafef(i8* %8, i32 512, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%12 = load %struct.sqlConnection*, %struct.sqlConnection** %4
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = call %struct.barChartData* @barChartDataLoadByQuery(%struct.sqlConnection* %12, i8* %13)
ret %struct.barChartData* %14
}

LLVM IR (-O2):
%struct.barChartData = type { i32 }
%struct.sqlConnection = type { i32 }
@.str = [34 x i8] c"SELECT * FROM %s WHERE locus='%s'\00"
define %struct.barChartData* @barChartDataLoadForLocus(%struct.sqlConnection* %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @sqlSafef(i8* %5, i32 512, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%7 = call %struct.barChartData* @barChartDataLoadByQuery(%struct.sqlConnection* %0, i8* %5)
ret %struct.barChartData* %7
}