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

/* Variables and functions */
size_t union_uint16(int /*<<< orphan*/ const *, size_t,
                    int /*<<< orphan*/ const *, size_t, int /*<<< orphan*/ *);
size_t fast_union_uint16(const uint16_t *set_1, size_t size_1,
                         const uint16_t *set_2, size_t size_2,
                         uint16_t *buffer) {
  if (size_1 < size_2) {
    return union_uint16(set_1, size_1, set_2, size_2, buffer);
  } else {
    return union_uint16(set_2, size_2, set_1, size_1, buffer);
  }
}


x86 assembly (clang, -O0):
<fast_union_uint16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    115c <fast_union_uint16+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1030 <union_uint16@plt>
mov    %rax,-0x8(%rbp)
jmp    1179 <fast_union_uint16+0x69>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1030 <union_uint16@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_union_uint16>:
mov    %rsi,%rax
mov    %rdi,%r9
cmp    %rcx,%rsi
jae    1126 <fast_union_uint16+0x16>
mov    %r9,%rdi
mov    %rax,%rsi
jmp    1030 <union_uint16@plt>
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %r9,%rdx
mov    %rax,%rcx
jmp    1030 <union_uint16@plt>

LLVM IR (-O0):
define i64 @fast_union_uint16(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4) {
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32*
store i32* %0, i32** %7
store i64 %1, i64* %8
store i32* %2, i32** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
%12 = load i64, i64* %8
%13 = load i64, i64* %10
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %5
%16 = load i32*, i32** %7
%17 = load i64, i64* %8
%18 = load i32*, i32** %9
%19 = load i64, i64* %10
%20 = load i32*, i32** %11
%21 = call i64 @union_uint16(i32* %16, i64 %17, i32* %18, i64 %19, i32* %20)
store i64 %21, i64* %6
br label %29
22: ; preds = %5
%23 = load i32*, i32** %9
%24 = load i64, i64* %10
%25 = load i32*, i32** %7
%26 = load i64, i64* %8
%27 = load i32*, i32** %11
%28 = call i64 @union_uint16(i32* %23, i64 %24, i32* %25, i64 %26, i32* %27)
store i64 %28, i64* %6
br label %29
29: ; preds = %22, %15
%30 = load i64, i64* %6
ret i64 %30
}

LLVM IR (-O2):
define i64 @fast_union_uint16(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4) {
%6 = icmp ult i64 %1, %3
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i64 @union_uint16(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4)
br label %11
9: ; preds = %5
%10 = tail call i64 @union_uint16(i32* %2, i64 %3, i32* %0, i64 %1, i32* %4)
br label %11
11: ; preds = %9, %7
%12 = phi i64 [ %8, %7 ], [ %10, %9 ]
ret i64 %12
}