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

/* Variables and functions */
int rt_cmp(struct babel_route const *, struct babel_route const *);
const struct babel_route *min_route(const struct babel_route *r1,
                                    const struct babel_route *r2) {
  int rc;
  if (!r1)
    return r2;
  if (!r2)
    return r1;
  rc = rt_cmp(r1, r2);
  return rc <= 0 ? r1 : r2;
}


x86 assembly (clang, -O0):
<min_route>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <min_route+0x28>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <min_route+0x77>
cmpq   $0x0,-0x18(%rbp)
jne    1150 <min_route+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <min_route+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <rt_cmp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     1177 <min_route+0x67>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    117f <min_route+0x6f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_route>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
test   %rdi,%rdi
je     113a <min_route+0x2a>
mov    %rdi,%r14
test   %rbx,%rbx
je     1137 <min_route+0x27>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <rt_cmp@plt>
test   %eax,%eax
cmovle %r14,%rbx
jmp    113a <min_route+0x2a>
mov    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.babel_route = type { i32 }
define %struct.babel_route* @min_route(%struct.babel_route* %0, %struct.babel_route* %1) {
%3 = alloca %struct.babel_route*
%4 = alloca %struct.babel_route*
%5 = alloca %struct.babel_route*
%6 = alloca i32
store %struct.babel_route* %0, %struct.babel_route** %4
store %struct.babel_route* %1, %struct.babel_route** %5
%7 = load %struct.babel_route*, %struct.babel_route** %4
%8 = icmp ne %struct.babel_route* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = load %struct.babel_route*, %struct.babel_route** %5
store %struct.babel_route* %10, %struct.babel_route** %3
br label %28
11: ; preds = %2
%12 = load %struct.babel_route*, %struct.babel_route** %5
%13 = icmp ne %struct.babel_route* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = load %struct.babel_route*, %struct.babel_route** %4
store %struct.babel_route* %15, %struct.babel_route** %3
br label %28
16: ; preds = %11
%17 = load %struct.babel_route*, %struct.babel_route** %4
%18 = load %struct.babel_route*, %struct.babel_route** %5
%19 = call i32 @rt_cmp(%struct.babel_route* %17, %struct.babel_route* %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = load %struct.babel_route*, %struct.babel_route** %4
br label %26
24: ; preds = %16
%25 = load %struct.babel_route*, %struct.babel_route** %5
br label %26
26: ; preds = %24, %22
%27 = phi %struct.babel_route* [ %23, %22 ], [ %25, %24 ]
store %struct.babel_route* %27, %struct.babel_route** %3
br label %28
28: ; preds = %26, %14, %9
%29 = load %struct.babel_route*, %struct.babel_route** %3
ret %struct.babel_route* %29
}

LLVM IR (-O2):
%struct.babel_route = type { i32 }
define %struct.babel_route* @min_route(%struct.babel_route* %0, %struct.babel_route* %1) {
%3 = icmp eq %struct.babel_route* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq %struct.babel_route* %1, null
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = tail call i32 @rt_cmp(%struct.babel_route* %0, %struct.babel_route* %1)
%8 = icmp slt i32 %7, 1
%9 = select i1 %8, %struct.babel_route* %0, %struct.babel_route* %1
br label %10
10: ; preds = %4, %2, %6
%11 = phi %struct.babel_route* [ %9, %6 ], [ %1, %2 ], [ %0, %4 ]
ret %struct.babel_route* %11
}