#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_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  int /*<<< orphan*/ fts_name;
  TYPE_1__ *fts_statp;
};
struct TYPE_5__ {
  scalar_t__ st_mtime;
};
typedef TYPE_2__ FTSENT;

/* Variables and functions */
int strcmp(int /*<<< orphan*/, int /*<<< orphan*/);
int mtimecmp(const FTSENT *p1, const FTSENT *p2) {
  if (p2->fts_statp->st_mtime > p1->fts_statp->st_mtime)
    return (1);
  else if (p2->fts_statp->st_mtime < p1->fts_statp->st_mtime)
    return (-1);
  else
    return (strcmp(p1->fts_name, p2->fts_name));
}


x86 assembly (clang, -O0):
<mtimecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
cmp    (%rcx),%rax
jle    1148 <mtimecmp+0x38>
movl   $0x1,-0x4(%rbp)
jmp    1184 <mtimecmp+0x74>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
cmp    (%rcx),%rax
jge    1170 <mtimecmp+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <mtimecmp+0x74>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtimecmp>:
mov    0x8(%rsi),%rcx
mov    0x8(%rdi),%rax
mov    (%rax),%rdx
mov    $0x1,%eax
cmp    %rdx,(%rcx)
jg     112c <mtimecmp+0x1c>
mov    $0xffffffff,%eax
jge    112d <mtimecmp+0x1d>
ret
mov    (%rdi),%edi
mov    (%rsi),%esi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__* }
%struct.TYPE_5__ = type { i64 }
define i32 @mtimecmp(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_6__*
%5 = alloca %struct.TYPE_6__*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %4
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %5
%6 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%7 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %6, i32 0, i32 1
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %11, i32 0, i32 1
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %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 %39
18: ; preds = %2
%19 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%20 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %19, i32 0, i32 1
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %20
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 0
%23 = load i64, i64* %22
%24 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %24, i32 0, i32 1
%26 = load %struct.TYPE_5__*, %struct.TYPE_5__** %25
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %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 %39
31: ; preds = %18
%32 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%33 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%36 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %35, i32 0, i32 0
%37 = load i32, i32* %36
%38 = call i32 @strcmp(i32 %34, i32 %37)
store i32 %38, i32* %3
br label %39
39: ; preds = %31, %30, %17
%40 = load i32, i32* %3
ret i32 %40
}

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