#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 */
typedef struct TYPE_8__ TYPE_2__;
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
struct TYPE_8__ {
  TYPE_1__ *fts_statp;
};
struct TYPE_7__ {
  scalar_t__ st_size;
};
typedef TYPE_2__ FTSENT;

/* Variables and functions */
int rtems_shell_ls_namecmp(TYPE_2__ const *, TYPE_2__ const *);
int rtems_shell_ls_sizecmp(const FTSENT *a, const FTSENT *b) {
  if (b->fts_statp->st_size > a->fts_statp->st_size)
    return (1);
  if (b->fts_statp->st_size < a->fts_statp->st_size)
    return (-1);
  else
    return (rtems_shell_ls_namecmp(a, b));
}


x86 assembly (clang, -O0):
<rtems_shell_ls_sizecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
cmp    (%rcx),%rax
jle    1146 <rtems_shell_ls_sizecmp+0x36>
movl   $0x1,-0x4(%rbp)
jmp    117c <rtems_shell_ls_sizecmp+0x6c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
cmp    (%rcx),%rax
jge    116c <rtems_shell_ls_sizecmp+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <rtems_shell_ls_sizecmp+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <rtems_shell_ls_namecmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtems_shell_ls_sizecmp>:
mov    (%rsi),%rcx
mov    (%rdi),%rax
mov    (%rax),%rdx
mov    $0x1,%eax
cmp    %rdx,(%rcx)
jg     112a <rtems_shell_ls_sizecmp+0x1a>
mov    $0xffffffff,%eax
jge    112b <rtems_shell_ls_sizecmp+0x1b>
ret
jmp    1030 <rtems_shell_ls_namecmp@plt>

LLVM IR (-O0):
%struct.TYPE_8__ = type { %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i64 }
define i32 @rtems_shell_ls_sizecmp(%struct.TYPE_8__* %0, %struct.TYPE_8__* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_8__*
%5 = alloca %struct.TYPE_8__*
store %struct.TYPE_8__* %0, %struct.TYPE_8__** %4
store %struct.TYPE_8__* %1, %struct.TYPE_8__** %5
%6 = load %struct.TYPE_8__*, %struct.TYPE_8__** %5
%7 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %6, i32 0, i32 0
%8 = load %struct.TYPE_7__*, %struct.TYPE_7__** %7
%9 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load %struct.TYPE_8__*, %struct.TYPE_8__** %4
%12 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %11, i32 0, i32 0
%13 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%14 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = icmp sgt i64 %10, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %35
18: ; preds = %2
%19 = load %struct.TYPE_8__*, %struct.TYPE_8__** %5
%20 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %19, i32 0, i32 0
%21 = load %struct.TYPE_7__*, %struct.TYPE_7__** %20
%22 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %21, i32 0, i32 0
%23 = load i64, i64* %22
%24 = load %struct.TYPE_8__*, %struct.TYPE_8__** %4
%25 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %24, i32 0, i32 0
%26 = load %struct.TYPE_7__*, %struct.TYPE_7__** %25
%27 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %26, i32 0, i32 0
%28 = load i64, i64* %27
%29 = icmp slt i64 %23, %28
br i1 %29, label %30, label %31
30: ; preds = %18
store i32 -1, i32* %3
br label %35
31: ; preds = %18
%32 = load %struct.TYPE_8__*, %struct.TYPE_8__** %4
%33 = load %struct.TYPE_8__*, %struct.TYPE_8__** %5
%34 = call i32 @rtems_shell_ls_namecmp(%struct.TYPE_8__* %32, %struct.TYPE_8__* %33)
store i32 %34, i32* %3
br label %35
35: ; preds = %31, %30, %17
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
%struct.TYPE_8__ = type { %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i64 }
define i32 @rtems_shell_ls_sizecmp(%struct.TYPE_8__* %0, %struct.TYPE_8__* %1) {
%3 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 0
%4 = load %struct.TYPE_7__*, %struct.TYPE_7__** %3
%5 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %4, i64 0, i32 0
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %0, i64 0, i32 0
%8 = load %struct.TYPE_7__*, %struct.TYPE_7__** %7
%9 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %8, i64 0, i32 0
%10 = load i64, i64* %9
%11 = icmp sgt i64 %6, %10
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = icmp slt i64 %6, %10
br i1 %13, label %16, label %14
14: ; preds = %12
%15 = tail call i32 @rtems_shell_ls_namecmp(%struct.TYPE_8__* %0, %struct.TYPE_8__* %1)
br label %16
16: ; preds = %12, %2, %14
%17 = phi i32 [ %15, %14 ], [ 1, %2 ], [ -1, %12 ]
ret i32 %17
}