#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*/ extractList_gap_il(void *, unsigned int, unsigned int **,
                                      unsigned int *, unsigned int);
int /*<<< orphan*/ free(unsigned int *);
unsigned int *intersect_aux_last2(unsigned int *, unsigned int, unsigned int *,
                                  unsigned int, unsigned int *, int);
int merge_2_uncompressFst(void *ail, unsigned int id1, unsigned int id2,
                          unsigned int *noccs, unsigned int **occs) {
  unsigned int GAP1 = 1;
  unsigned int GAP2 = 0;
  unsigned int len1;
  unsigned int *arr1;
  extractList_gap_il(ail, id1, &arr1, &len1, GAP1);
  unsigned int len2;
  unsigned int *arr2;
  extractList_gap_il(ail, id2, &arr2, &len2, GAP2);
  *occs = intersect_aux_last2(arr1, len1, arr2, len2, noccs, +1);
  free(arr2);
  return 0;
}


x86 assembly (clang, -O0):
<merge_2_uncompressFst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%r8d
lea    -0x38(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1050 <extractList_gap_il@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%r8d
lea    -0x48(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1050 <extractList_gap_il@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    $0x1,%r9d
call   1040 <intersect_aux_last2@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_2_uncompressFst>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    $0x1,%r8d
call   1050 <extractList_gap_il@plt>
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %r8d,%r8d
call   1050 <extractList_gap_il@plt>
mov    0x10(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    (%rsp),%ecx
mov    %r15,%r8
mov    $0x1,%r9d
call   1040 <intersect_aux_last2@plt>
mov    %rax,(%r14)
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @merge_2_uncompressFst(i8* %0, i32 %1, i32 %2, i32* %3, i32** %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32** %4, i32*** %10
store i32 1, i32* %11
store i32 0, i32* %12
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %11
%20 = call i32 @extractList_gap_il(i8* %17, i32 %18, i32** %14, i32* %13, i32 %19)
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = load i32, i32* %12
%24 = call i32 @extractList_gap_il(i8* %21, i32 %22, i32** %16, i32* %15, i32 %23)
%25 = load i32*, i32** %14
%26 = load i32, i32* %13
%27 = load i32*, i32** %16
%28 = load i32, i32* %15
%29 = load i32*, i32** %9
%30 = call i32* @intersect_aux_last2(i32* %25, i32 %26, i32* %27, i32 %28, i32* %29, i32 1)
%31 = load i32**, i32*** %10
store i32* %30, i32** %31
%32 = load i32*, i32** %16
%33 = call i32 @free(i32* %32)
ret i32 0
}

LLVM IR (-O2):
define i32 @merge_2_uncompressFst(i8* %0, i32 %1, i32 %2, i32* %3, i32** nocapture writeonly %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32** %7 to i8*
%12 = call i32 @extractList_gap_il(i8* %0, i32 %1, i32** %7, i32* %6, i32 1)
%13 = bitcast i32* %8 to i8*
%14 = bitcast i32** %9 to i8*
%15 = call i32 @extractList_gap_il(i8* %0, i32 %2, i32** %9, i32* %8, i32 0)
%16 = load i32*, i32** %7
%17 = load i32, i32* %6
%18 = load i32*, i32** %9
%19 = load i32, i32* %8
%20 = call i32* @intersect_aux_last2(i32* %16, i32 %17, i32* %18, i32 %19, i32* %3, i32 1)
store i32* %20, i32** %4
%21 = load i32*, i32** %9
%22 = call i32 @free(i32* %21)
ret i32 0
}