#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 _RegionHandle {
  int dummy;
};
struct Cyc_List_List {
  int dummy;
};

/* Variables and functions */
struct Cyc_List_List *Cyc_List_rcopy(struct _RegionHandle *,
                                     struct Cyc_List_List *);
struct Cyc_List_List *Cyc_List_rimp_merge_sort(int (*)(void *, void *),
                                               struct Cyc_List_List *);
struct Cyc_List_List *Cyc_List_rmerge_sort(struct _RegionHandle *r,
                                           int (*less_eq)(void *, void *),
                                           struct Cyc_List_List *x) {
  int (*_T0)(void *, void *);
  struct Cyc_List_List *_T1;
  struct Cyc_List_List *_T2;
  _T0 = less_eq;
  _T1 = Cyc_List_rcopy(r, x);
  _T2 = Cyc_List_rimp_merge_sort(_T0, _T1);
  return _T2;
}


x86 assembly (clang, -O0):
<Cyc_List_rmerge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <Cyc_List_rcopy@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <Cyc_List_rimp_merge_sort@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_List_rmerge_sort>:
push   %rbx
mov    %rsi,%rbx
mov    %rdx,%rsi
call   1040 <Cyc_List_rcopy@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <Cyc_List_rimp_merge_sort@plt>

LLVM IR (-O0):
%struct._RegionHandle = type { i32 }
%struct.Cyc_List_List = type { i32 }
define %struct.Cyc_List_List* @Cyc_List_rmerge_sort(%struct._RegionHandle* %0, i32 (i8*, i8*)* %1, %struct.Cyc_List_List* %2) {
%4 = alloca %struct._RegionHandle*
%5 = alloca i32 (i8*, i8*)*
%6 = alloca %struct.Cyc_List_List*
%7 = alloca i32 (i8*, i8*)*
%8 = alloca %struct.Cyc_List_List*
%9 = alloca %struct.Cyc_List_List*
store %struct._RegionHandle* %0, %struct._RegionHandle** %4
store i32 (i8*, i8*)* %1, i32 (i8*, i8*)** %5
store %struct.Cyc_List_List* %2, %struct.Cyc_List_List** %6
%10 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %5
store i32 (i8*, i8*)* %10, i32 (i8*, i8*)** %7
%11 = load %struct._RegionHandle*, %struct._RegionHandle** %4
%12 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %6
%13 = call %struct.Cyc_List_List* @Cyc_List_rcopy(%struct._RegionHandle* %11, %struct.Cyc_List_List* %12)
store %struct.Cyc_List_List* %13, %struct.Cyc_List_List** %8
%14 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %7
%15 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %8
%16 = call %struct.Cyc_List_List* @Cyc_List_rimp_merge_sort(i32 (i8*, i8*)* %14, %struct.Cyc_List_List* %15)
store %struct.Cyc_List_List* %16, %struct.Cyc_List_List** %9
%17 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %9
ret %struct.Cyc_List_List* %17
}

LLVM IR (-O2):
%struct._RegionHandle = type { i32 }
%struct.Cyc_List_List = type { i32 }
define %struct.Cyc_List_List* @Cyc_List_rmerge_sort(%struct._RegionHandle* %0, i32 (i8*, i8*)* %1, %struct.Cyc_List_List* %2) {
%4 = tail call %struct.Cyc_List_List* @Cyc_List_rcopy(%struct._RegionHandle* %0, %struct.Cyc_List_List* %2)
%5 = tail call %struct.Cyc_List_List* @Cyc_List_rimp_merge_sort(i32 (i8*, i8*)* %1, %struct.Cyc_List_List* %4)
ret %struct.Cyc_List_List* %5
}