#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_context;

/* Variables and functions */
int SQLITE_FLOAT;
int SQLITE_INTEGER;
int SQLITE_NULL;
int /*<<< orphan*/ sqlite3_result_error(int /*<<< orphan*/ *, char *, int);
void validateTypes(sqlite3_context *context, int a, int b) {
  if (a == SQLITE_NULL || b == SQLITE_NULL) {
    sqlite3_result_error(context, "Null types.", -1);
  }
  if ((a != SQLITE_INTEGER && a != SQLITE_FLOAT) || a != b) {
    sqlite3_result_error(context, "Incompatible types.", -1);
  }
}


x86 assembly (clang, -O0):
<validateTypes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ebc(%rip),%rcx
cmp    (%rcx),%eax
je     1146 <validateTypes+0x36>
mov    -0x10(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
jne    115b <validateTypes+0x4b>
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <sqlite3_result_error@plt>
mov    -0xc(%rbp),%eax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
je     117f <validateTypes+0x6f>
mov    -0xc(%rbp),%eax
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
jne    118b <validateTypes+0x7b>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11a0 <validateTypes+0x90>
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <sqlite3_result_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validateTypes>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
mov    0x2ec6(%rip),%rax
mov    (%rax),%eax
cmp    %esi,%eax
je     112c <validateTypes+0x1c>
cmp    %ebp,%eax
jne    1140 <validateTypes+0x30>
lea    0xecd(%rip),%rsi
mov    %r14,%rdi
mov    $0xffffffff,%edx
call   1030 <sqlite3_result_error@plt>
mov    0x2e91(%rip),%rax
cmp    %ebx,(%rax)
sete   %al
mov    0x2e8d(%rip),%rcx
cmp    %ebx,(%rcx)
sete   %cl
cmp    %ebp,%ebx
jne    1165 <validateTypes+0x55>
or     %cl,%al
je     1165 <validateTypes+0x55>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xea0(%rip),%rsi
mov    %r14,%rdi
mov    $0xffffffff,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <sqlite3_result_error@plt>

LLVM IR (-O0):
@SQLITE_NULL = global i32 0
@.str = [12 x i8] c"Null types.\00"
@SQLITE_INTEGER = global i32 0
@SQLITE_FLOAT = global i32 0
@.str.1 = [20 x i8] c"Incompatible types.\00"
define void @validateTypes(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* @SQLITE_NULL
%9 = icmp eq i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i32, i32* %6
%12 = load i32, i32* @SQLITE_NULL
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10, %3
%15 = load i32*, i32** %4
%16 = call i32 @sqlite3_result_error(i32* %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %5
%19 = load i32, i32* @SQLITE_INTEGER
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* @SQLITE_FLOAT
%24 = icmp ne i32 %22, %23
br i1 %24, label %29, label %25
25: ; preds = %21, %17
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %25, %21
%30 = load i32*, i32** %4
%31 = call i32 @sqlite3_result_error(i32* %30, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %32
32: ; preds = %29, %25
ret void
}

LLVM IR (-O2):
@SQLITE_NULL = global i32 0
@.str = [12 x i8] c"Null types.\00"
@SQLITE_INTEGER = global i32 0
@SQLITE_FLOAT = global i32 0
@.str.1 = [20 x i8] c"Incompatible types.\00"
define void @validateTypes(i32* %0, i32 %1, i32 %2) {
%4 = load i32, i32* @SQLITE_NULL
%5 = icmp eq i32 %4, %1
%6 = icmp eq i32 %4, %2
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @sqlite3_result_error(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %10
10: ; preds = %3, %8
%11 = load i32, i32* @SQLITE_INTEGER
%12 = icmp eq i32 %11, %1
%13 = load i32, i32* @SQLITE_FLOAT
%14 = icmp eq i32 %13, %1
%15 = select i1 %12, i1 true, i1 %14
%16 = icmp eq i32 %1, %2
%17 = and i1 %16, %15
br i1 %17, label %20, label %18
18: ; preds = %10
%19 = tail call i32 @sqlite3_result_error(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %20
20: ; preds = %10, %18
ret void
}