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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int cmp_ints(size_t size_a, const void *key_a, size_t size_b,
             const void *key_b) {
  int *a, *b;
  assert(size_a == sizeof(*a));
  assert(size_b == sizeof(*b));
  a = (int *)key_a;
  b = (int *)key_b;
  if (*a > *b) {
    return 1;
  } else if (*a < *b) {
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cmp_ints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x4,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x4,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    -0x38(%rbp),%rcx
cmp    (%rcx),%eax
jle    117a <cmp_ints+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    119f <cmp_ints+0x8f>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    -0x38(%rbp),%rcx
cmp    (%rcx),%eax
jge    1198 <cmp_ints+0x88>
movl   $0xffffffff,-0x4(%rbp)
jmp    119f <cmp_ints+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_ints>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
xor    %eax,%eax
cmp    $0x4,%rdi
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x4,%rbx
sete   %dil
call   1030 <assert@plt>
mov    (%r15),%eax
mov    (%r14),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cmp_ints(i64 %0, i8* %1, i64 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
store i64 %0, i64* %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, 4
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i64, i64* %8
%17 = icmp eq i64 %16, 4
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i8*, i8** %7
%21 = bitcast i8* %20 to i32*
store i32* %21, i32** %10
%22 = load i8*, i8** %9
%23 = bitcast i8* %22 to i32*
store i32* %23, i32** %11
%24 = load i32*, i32** %10
%25 = load i32, i32* %24
%26 = load i32*, i32** %11
%27 = load i32, i32* %26
%28 = icmp sgt i32 %25, %27
br i1 %28, label %29, label %30
29: ; preds = %4
store i32 1, i32* %5
br label %38
30: ; preds = %4
%31 = load i32*, i32** %10
%32 = load i32, i32* %31
%33 = load i32*, i32** %11
%34 = load i32, i32* %33
%35 = icmp slt i32 %32, %34
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 -1, i32* %5
br label %38
37: ; preds = %30
store i32 0, i32* %5
br label %38
38: ; preds = %37, %36, %29
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
define i32 @cmp_ints(i64 %0, i8* nocapture %1, i64 %2, i8* nocapture %3) {
%5 = icmp eq i64 %0, 4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp eq i64 %2, 4
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = bitcast i8* %1 to i32*
%12 = bitcast i8* %3 to i32*
%13 = load i32, i32* %11
%14 = load i32, i32* %12
%15 = icmp sgt i32 %13, %14
%16 = icmp slt i32 %13, %14
%17 = sext i1 %16 to i32
%18 = select i1 %15, i32 1, i32 %17
ret i32 %18
}