#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 SQLITE_OK;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int sqlite3_exec(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *, char **);
int /*<<< orphan*/ sqlite3_free(char *);
int /*<<< orphan*/ stderr;
int quiet_exec(sqlite3 *db, const char *sql) {
  int rc;
  char *zErrMsg = 0;
  rc = sqlite3_exec(db, sql, NULL, NULL, &zErrMsg);
  if (rc != SQLITE_OK) {
    fprintf(stderr, "-ERR %s\n", zErrMsg);
    sqlite3_free(zErrMsg);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<quiet_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x28(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%eax
je     11a3 <quiet_exec+0x73>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <sqlite3_free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11aa <quiet_exec+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quiet_exec>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
xor    %ebx,%ebx
lea    0x8(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sqlite3_exec@plt>
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     1182 <quiet_exec+0x52>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1050 <sqlite3_free@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SQLITE_OK = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"-ERR %s\0A\00"
define i32 @quiet_exec(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* null, i8** %7
%8 = load i32*, i32** %4
%9 = load i8*, i8** %5
%10 = call i32 @sqlite3_exec(i32* %8, i8* %9, i32* null, i32* null, i8** %7)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* @SQLITE_OK
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %7
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %7
%19 = call i32 @sqlite3_free(i8* %18)
store i32 1, i32* %3
br label %21
20: ; preds = %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %14
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@SQLITE_OK = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"-ERR %s\0A\00"
define i32 @quiet_exec(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @sqlite3_exec(i32* %0, i8* %1, i32* null, i32* null, i8** %3)
%6 = load i32, i32* @SQLITE_OK
%7 = icmp eq i32 %5, %6
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @sqlite3_free(i8* %12)
br label %14
14: ; preds = %2, %8
%15 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %15
}