#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*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ *database_init();
int /*<<< orphan*/ database_sql_exec(int /*<<< orphan*/ *, char *,
                                     int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ database_term(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sqlite3_free(char *);
char *sqlite3_mprintf(char *, char const *, char const *);
int /*<<< orphan*/ stderr;
void database_hedsrc(const char *header, const char *source) {
  sqlite3 *db;
  char *sql;
  db = database_init();
  database_sql_exec(db, "BEGIN", 0, 0);
  sql = sqlite3_mprintf("INSERT INTO srcinc VALUES (%Q,%Q);", header, source);
  fprintf(stderr, "sql = `%s'\n", sql);
  database_sql_exec(db, sql, 0, 0);
  sqlite3_free(sql);
  database_sql_exec(db, "COMMIT", 0, 0);
  database_term(db);
}


x86 assembly (clang, -O0):
<database_hedsrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <database_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7a(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <database_sql_exec@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe68(%rip),%rdi
call   1070 <sqlite3_mprintf@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe6e(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <database_sql_exec@plt>
mov    -0x20(%rbp),%rdi
call   1060 <sqlite3_free@plt>
mov    -0x18(%rbp),%rdi
lea    0xe50(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <database_sql_exec@plt>
mov    -0x18(%rbp),%rdi
call   1040 <database_term@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<database_hedsrc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1080 <database_init@plt>
mov    %rax,%r12
lea    0xe81(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <database_sql_exec@plt>
lea    0xe74(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1070 <sqlite3_mprintf@plt>
mov    %rax,%rbx
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <database_sql_exec@plt>
mov    %rbx,%rdi
call   1060 <sqlite3_free@plt>
lea    0xe5f(%rip),%rsi
mov    %r12,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <database_sql_exec@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <database_term@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"BEGIN\00"
@.str.1 = [35 x i8] c"INSERT INTO srcinc VALUES (%Q,%Q);\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"sql = `%s'\0A\00"
@.str.3 = [7 x i8] c"COMMIT\00"
define void @database_hedsrc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = call i32* (...) @database_init()
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = call i32 @database_sql_exec(i32* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i8* @sqlite3_mprintf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11)
store i8* %12, i8** %6
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %6
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %5
%17 = load i8*, i8** %6
%18 = call i32 @database_sql_exec(i32* %16, i8* %17, i32 0, i32 0)
%19 = load i8*, i8** %6
%20 = call i32 @sqlite3_free(i8* %19)
%21 = load i32*, i32** %5
%22 = call i32 @database_sql_exec(i32* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0)
%23 = load i32*, i32** %5
%24 = call i32 @database_term(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"BEGIN\00"
@.str.1 = [35 x i8] c"INSERT INTO srcinc VALUES (%Q,%Q);\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"sql = `%s'\0A\00"
@.str.3 = [7 x i8] c"COMMIT\00"
define void @database_hedsrc(i8* %0, i8* %1) {
%3 = tail call i32* (...) @database_init()
%4 = tail call i32 @database_sql_exec(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%5 = tail call i8* @sqlite3_mprintf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%8 = tail call i32 @database_sql_exec(i32* %3, i8* %5, i32 0, i32 0)
%9 = tail call i32 @sqlite3_free(i8* %5)
%10 = tail call i32 @database_sql_exec(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0)
%11 = tail call i32 @database_term(i32* %3)
ret void
}