#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*/ edge_sizes(int, int *, int *);
int /*<<< orphan*/ subset_it_idx_for_id(int, int, int *, int);
int tr_less_than(int n, int a, int b) {
  int dist_a[3];
  int t_a[3];
  subset_it_idx_for_id(a, n, t_a, 3);
  edge_sizes(n, t_a, dist_a);
  int dist_b[3];
  int t_b[3];
  subset_it_idx_for_id(b, n, t_b, 3);
  edge_sizes(n, t_b, dist_b);
  if (dist_a[0] < dist_b[0]) {
    return 1;
  } else if (dist_a[1] < dist_b[1]) {
    return 1;
  } else if (dist_a[2] < dist_b[2]) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<tr_less_than>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x28(%rbp),%rdx
mov    $0x3,%ecx
call   1040 <subset_it_idx_for_id@plt>
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <edge_sizes@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    $0x3,%ecx
call   1040 <subset_it_idx_for_id@plt>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1030 <edge_sizes@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1191 <tr_less_than+0x71>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <tr_less_than+0xa8>
mov    -0x18(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    11a9 <tr_less_than+0x89>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <tr_less_than+0xa8>
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11c1 <tr_less_than+0xa1>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <tr_less_than+0xa8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr_less_than>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %edx,%ebx
mov    %edi,%ebp
lea    0x24(%rsp),%r14
mov    %esi,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    $0x3,%ecx
call   1040 <subset_it_idx_for_id@plt>
lea    0xc(%rsp),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <edge_sizes@plt>
lea    0x18(%rsp),%r14
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    $0x3,%ecx
call   1040 <subset_it_idx_for_id@plt>
mov    %rsp,%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <edge_sizes@plt>
mov    0xc(%rsp),%ecx
mov    $0x1,%eax
cmp    (%rsp),%ecx
jl     1199 <tr_less_than+0x79>
mov    0x10(%rsp),%ecx
cmp    0x4(%rsp),%ecx
jl     1199 <tr_less_than+0x79>
mov    0x14(%rsp),%ecx
xor    %eax,%eax
cmp    0x8(%rsp),%ecx
setl   %al
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @tr_less_than(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i32]
%9 = alloca [3 x i32]
%10 = alloca [3 x i32]
%11 = alloca [3 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %5
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%15 = call i32 @subset_it_idx_for_id(i32 %12, i32 %13, i32* %14, i32 3)
%16 = load i32, i32* %5
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%19 = call i32 @edge_sizes(i32 %16, i32* %17, i32* %18)
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 0
%23 = call i32 @subset_it_idx_for_id(i32 %20, i32 %21, i32* %22, i32 3)
%24 = load i32, i32* %5
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 0
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%27 = call i32 @edge_sizes(i32 %24, i32* %25, i32* %26)
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%29 = load i32, i32* %28
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%31 = load i32, i32* %30
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %34
33: ; preds = %3
store i32 1, i32* %4
br label %49
34: ; preds = %3
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
%36 = load i32, i32* %35
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
%38 = load i32, i32* %37
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %41
40: ; preds = %34
store i32 1, i32* %4
br label %49
41: ; preds = %34
%42 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
%43 = load i32, i32* %42
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
%45 = load i32, i32* %44
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %48
47: ; preds = %41
store i32 1, i32* %4
br label %49
48: ; preds = %41
store i32 0, i32* %4
br label %49
49: ; preds = %48, %47, %40, %33
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
define i32 @tr_less_than(i32 %0, i32 %1, i32 %2) {
%4 = alloca [3 x i32]
%5 = alloca [3 x i32]
%6 = alloca [3 x i32]
%7 = alloca [3 x i32]
%8 = bitcast [3 x i32]* %4 to i8*
%9 = bitcast [3 x i32]* %5 to i8*
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%11 = call i32 @subset_it_idx_for_id(i32 %1, i32 %0, i32* %10, i32 3)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%13 = call i32 @edge_sizes(i32 %0, i32* %10, i32* %12)
%14 = bitcast [3 x i32]* %6 to i8*
%15 = bitcast [3 x i32]* %7 to i8*
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%17 = call i32 @subset_it_idx_for_id(i32 %2, i32 %0, i32* %16, i32 3)
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%19 = call i32 @edge_sizes(i32 %0, i32* %16, i32* %18)
%20 = load i32, i32* %12
%21 = load i32, i32* %18
%22 = icmp slt i32 %20, %21
br i1 %22, label %36, label %23
23: ; preds = %3
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
%25 = load i32, i32* %24
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
%27 = load i32, i32* %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %36, label %29
29: ; preds = %23
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%31 = load i32, i32* %30
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 2
%33 = load i32, i32* %32
%34 = icmp slt i32 %31, %33
%35 = zext i1 %34 to i32
br label %36
36: ; preds = %29, %23, %3
%37 = phi i32 [ 1, %3 ], [ 1, %23 ], [ %35, %29 ]
ret i32 %37
}