#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 usershell_test_data {
  int dummy;
};

/* Variables and functions */
int __usershell_test_data_compare(
    struct usershell_test_data *, struct usershell_test_data *,
    int (*)(struct usershell *, struct usershell *, void *), void *);
int __usershell_2pass_test(struct usershell_test_data *td1,
                           struct usershell_test_data *td2,
                           int (*cmp_func)(struct usershell *,
                                           struct usershell *, void *),
                           void *cmp_mdata) {
  int rv;
  rv = __usershell_test_data_compare(td1, td2, cmp_func, cmp_mdata);
  return (rv);
}


x86 assembly (clang, -O0):
<__usershell_2pass_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <__usershell_test_data_compare@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__usershell_2pass_test>:
jmp    1030 <__usershell_test_data_compare@plt>

LLVM IR (-O0):
%struct.usershell_test_data = type { i32 }
%struct.usershell = type opaque
%struct.usershell.0 = type opaque
define i32 @__usershell_2pass_test(%struct.usershell_test_data* %0, %struct.usershell_test_data* %1, i32 (%struct.usershell*, %struct.usershell*, i8*)* %2, i8* %3) {
%5 = alloca %struct.usershell_test_data*
%6 = alloca %struct.usershell_test_data*
%7 = alloca i32 (%struct.usershell*, %struct.usershell*, i8*)*
%8 = alloca i8*
%9 = alloca i32
store %struct.usershell_test_data* %0, %struct.usershell_test_data** %5
store %struct.usershell_test_data* %1, %struct.usershell_test_data** %6
store i32 (%struct.usershell*, %struct.usershell*, i8*)* %2, i32 (%struct.usershell*, %struct.usershell*, i8*)** %7
store i8* %3, i8** %8
%10 = load %struct.usershell_test_data*, %struct.usershell_test_data** %5
%11 = load %struct.usershell_test_data*, %struct.usershell_test_data** %6
%12 = load i32 (%struct.usershell*, %struct.usershell*, i8*)*, i32 (%struct.usershell*, %struct.usershell*, i8*)** %7
%13 = bitcast i32 (%struct.usershell*, %struct.usershell*, i8*)* %12 to i32 (%struct.usershell.0*, %struct.usershell.0*, i8*)*
%14 = load i8*, i8** %8
%15 = call i32 @__usershell_test_data_compare(%struct.usershell_test_data* %10, %struct.usershell_test_data* %11, i32 (%struct.usershell.0*, %struct.usershell.0*, i8*)* %13, i8* %14)
store i32 %15, i32* %9
%16 = load i32, i32* %9
ret i32 %16
}

LLVM IR (-O2):
%struct.usershell_test_data = type { i32 }
%struct.usershell = type opaque
%struct.usershell.0 = type opaque
define i32 @__usershell_2pass_test(%struct.usershell_test_data* %0, %struct.usershell_test_data* %1, i32 (%struct.usershell*, %struct.usershell*, i8*)* %2, i8* %3) {
%5 = bitcast i32 (%struct.usershell*, %struct.usershell*, i8*)* %2 to i32 (%struct.usershell.0*, %struct.usershell.0*, i8*)*
%6 = tail call i32 @__usershell_test_data_compare(%struct.usershell_test_data* %0, %struct.usershell_test_data* %1, i32 (%struct.usershell.0*, %struct.usershell.0*, i8*)* %5, i8* %3)
ret i32 %6
}