#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;
};
typedef int /*<<< orphan*/ query;

/* Variables and functions */
scalar_t__ sqlQuickNum(struct sqlConnection *, char *);
int /*<<< orphan*/ sqlSafef(char *, int, char *, char *, char *, char *);
int liftOverChainExists(struct sqlConnection *conn, char *tableName,
                        char *fromDb, char *toDb) {
  char query[256];
  sqlSafef(query, sizeof(query),
           "select count(*) from %s where fromDb = '%s' and toDb = '%s'",
           tableName, fromDb, toDb);
  return sqlQuickNum(conn, query) > 0;
}


x86 assembly (clang, -O0):
<liftOverChainExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    $0x100,%esi
lea    0xea6(%rip),%rdx
call   1030 <sqlSafef@plt>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <sqlQuickNum@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<liftOverChainExists>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xec3(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1030 <sqlSafef@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sqlQuickNum@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
mov    %ecx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sqlConnection = type { i32 }
@.str = [60 x i8] c"select count(*) from %s where fromDb = '%s' and toDb = '%s'\00"
define i32 @liftOverChainExists(%struct.sqlConnection* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.sqlConnection*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [256 x i8]
store %struct.sqlConnection* %0, %struct.sqlConnection** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call i32 @sqlSafef(i8* %10, i32 256, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12, i8* %13)
%15 = load %struct.sqlConnection*, %struct.sqlConnection** %5
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%17 = call i64 @sqlQuickNum(%struct.sqlConnection* %15, i8* %16)
%18 = icmp sgt i64 %17, 0
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
%struct.sqlConnection = type { i32 }
@.str = [60 x i8] c"select count(*) from %s where fromDb = '%s' and toDb = '%s'\00"
define i32 @liftOverChainExists(%struct.sqlConnection* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = call i32 @sqlSafef(i8* %6, i32 256, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
%8 = call i64 @sqlQuickNum(%struct.sqlConnection* %0, i8* %6)
%9 = icmp sgt i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}