#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 stat {
  int st_atime;
};

/* Variables and functions */
int _ls_error(char *, int /*<<< orphan*/);
scalar_t__ lstat(char *, struct stat *);
int _acccmp(char *a, char *b) {
  struct stat sta;
  struct stat stb;
  if (lstat(a, &sta) != 0)
    return _ls_error(a, 0);
  if (lstat(b, &stb) != 0)
    return _ls_error(b, 0);
  return sta.st_atime - stb.st_atime;
}


x86 assembly (clang, -O0):
<_acccmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <lstat@plt>
cmp    $0x0,%rax
je     115a <_acccmp+0x3a>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <_ls_error@plt>
mov    %eax,-0x4(%rbp)
jmp    118d <_acccmp+0x6d>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <lstat@plt>
cmp    $0x0,%rax
je     1184 <_acccmp+0x64>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <_ls_error@plt>
mov    %eax,-0x4(%rbp)
jmp    118d <_acccmp+0x6d>
mov    -0x20(%rbp),%eax
sub    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_acccmp>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rsi
call   1030 <lstat@plt>
test   %rax,%rax
je     1141 <_acccmp+0x21>
mov    %rbx,%rdi
jmp    1156 <_acccmp+0x36>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <lstat@plt>
test   %rax,%rax
je     1164 <_acccmp+0x44>
mov    %r14,%rdi
xor    %esi,%esi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1040 <_ls_error@plt>
mov    0x10(%rsp),%eax
sub    0x8(%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @_acccmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.stat
%7 = alloca %struct.stat
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @lstat(i8* %8, %struct.stat* %6)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @_ls_error(i8* %12, i32 0)
store i32 %13, i32* %3
br label %27
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = call i64 @lstat(i8* %15, %struct.stat* %7)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = call i32 @_ls_error(i8* %19, i32 0)
store i32 %20, i32* %3
br label %27
21: ; preds = %14
%22 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%25 = load i32, i32* %24
%26 = sub nsw i32 %23, %25
store i32 %26, i32* %3
br label %27
27: ; preds = %21, %18, %11
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @_acccmp(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.stat* %4 to i8*
%7 = call i64 @lstat(i8* %0, %struct.stat* %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 @_ls_error(i8* %0, i32 0)
br label %22
11: ; preds = %2
%12 = call i64 @lstat(i8* %1, %struct.stat* %4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @_ls_error(i8* %1, i32 0)
br label %22
16: ; preds = %11
%17 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%20 = load i32, i32* %19
%21 = sub nsw i32 %18, %20
br label %22
22: ; preds = %16, %14, %9
%23 = phi i32 [ %10, %9 ], [ %15, %14 ], [ %21, %16 ]
ret i32 %23
}