#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 */
typedef int uid_t;
struct tm {
  int dummy;
};
struct ar_hdr {
  int dummy;
};
typedef int /*<<< orphan*/ mode_t;
typedef int gid_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int _ar_error(char *, int);
struct tm *_ar_get_date(struct ar_hdr *);
scalar_t__ _ar_get_gid(struct ar_hdr *, int *);
scalar_t__ _ar_get_mode(struct ar_hdr *, int /*<<< orphan*/ *);
scalar_t__ _ar_get_size(struct ar_hdr *, size_t *);
scalar_t__ _ar_get_uid(struct ar_hdr *, int *);
char *_long_mode(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *,
                           char *);
int /*<<< orphan*/ printf(char *, char *, int, int, size_t, char *,
                          char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strftime(char *, int, char *, struct tm *);
int _t_print_long(char const *archive, struct ar_hdr *hdr, char const *name) {
  mode_t mode;
  uid_t uid;
  gid_t gid;
  size_t size;
  struct tm *tm;
  char buf[24];
  if (_ar_get_mode(hdr, &mode) != 0 || _ar_get_uid(hdr, &uid) != 0 ||
      _ar_get_gid(hdr, &gid) != 0 || _ar_get_size(hdr, &size) != 0 ||
      (tm = _ar_get_date(hdr)) == NULL) {
    fprintf(stderr, "%s%s%s",
            "ar"
            ": ",
            archive, ": Invalid archive\n");
    return 1;
  }
  if (strftime(buf, sizeof(buf), "%b %d %H:%M %Y", tm) == 0)
    return _ar_error("strftime", 1);
  printf("%s %u/%u %10zu %s %s\n", _long_mode(mode), uid, gid, size, buf, name);
  return 0;
}


x86 assembly (clang, -O0):
<_t_print_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   10b0 <_ar_get_mode@plt>
cmp    $0x0,%rax
jne    1227 <_t_print_long+0x87>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <_ar_get_uid@plt>
cmp    $0x0,%rax
jne    1227 <_t_print_long+0x87>
mov    -0x18(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1090 <_ar_get_gid@plt>
cmp    $0x0,%rax
jne    1227 <_t_print_long+0x87>
mov    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <_ar_get_size@plt>
cmp    $0x0,%rax
jne    1227 <_t_print_long+0x87>
mov    -0x18(%rbp),%rdi
call   1070 <_ar_get_date@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    125a <_t_print_long+0xba>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
lea    0xdc5(%rip),%rsi
lea    0xdc5(%rip),%rdx
lea    0xdc3(%rip),%r8
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ca <_t_print_long+0x12a>
lea    -0x60(%rbp),%rdi
mov    -0x40(%rbp),%rcx
mov    $0x18,%esi
lea    0xdb1(%rip),%rdx
call   10a0 <strftime@plt>
cmp    $0x0,%rax
jne    1296 <_t_print_long+0xf6>
lea    0xdaa(%rip),%rdi
mov    $0x1,%esi
call   10c0 <_ar_error@plt>
mov    %eax,-0x4(%rbp)
jmp    12ca <_t_print_long+0x12a>
mov    -0x24(%rbp),%edi
call   1030 <_long_mode@plt>
mov    %rax,%rsi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x38(%rbp),%r8
lea    -0x60(%rbp),%r9
mov    -0x20(%rbp),%rax
lea    0xd7d(%rip),%rdi
mov    %rax,(%rsp)
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_t_print_long>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   10b0 <_ar_get_mode@plt>
test   %rax,%rax
jne    11fa <_t_print_long+0x5a>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <_ar_get_uid@plt>
test   %rax,%rax
jne    11fa <_t_print_long+0x5a>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <_ar_get_gid@plt>
test   %rax,%rax
jne    11fa <_t_print_long+0x5a>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <_ar_get_size@plt>
test   %rax,%rax
je     122f <_t_print_long+0x8f>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xdf6(%rip),%rsi
lea    0xdf6(%rip),%rdx
lea    0xdf4(%rip),%r8
mov    %r15,%rcx
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
call   1070 <_ar_get_date@plt>
test   %rax,%rax
je     11fa <_t_print_long+0x5a>
lea    0xddc(%rip),%rdx
lea    0x20(%rsp),%rdi
mov    $0x18,%esi
mov    %rax,%rcx
call   10a0 <strftime@plt>
test   %rax,%rax
je     128c <_t_print_long+0xec>
mov    0x14(%rsp),%edi
call   1030 <_long_mode@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x18(%rsp),%r8
mov    %r14,(%rsp)
lea    0xdbc(%rip),%rdi
lea    0x20(%rsp),%r9
mov    %rax,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
jmp    1225 <_t_print_long+0x85>
lea    0xd9b(%rip),%rdi
mov    $0x1,%esi
call   10c0 <_ar_error@plt>
jmp    1225 <_t_print_long+0x85>

LLVM IR (-O0):
%struct.ar_hdr = type { i32 }
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [5 x i8] c"ar: \00"
@.str.2 = [19 x i8] c": Invalid archive\0A\00"
@.str.3 = [15 x i8] c"%b %d %H:%M %Y\00"
@.str.4 = [9 x i8] c"strftime\00"
@.str.5 = [22 x i8] c"%s %u/%u %10zu %s %s\0A\00"
define i32 @_t_print_long(i8* %0, %struct.ar_hdr* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.ar_hdr*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca %struct.tm*
%13 = alloca [24 x i8]
store i8* %0, i8** %5
store %struct.ar_hdr* %1, %struct.ar_hdr** %6
store i8* %2, i8** %7
%14 = load %struct.ar_hdr*, %struct.ar_hdr** %6
%15 = call i64 @_ar_get_mode(%struct.ar_hdr* %14, i32* %8)
%16 = icmp ne i64 %15, 0
br i1 %16, label %33, label %17
17: ; preds = %3
%18 = load %struct.ar_hdr*, %struct.ar_hdr** %6
%19 = call i64 @_ar_get_uid(%struct.ar_hdr* %18, i32* %9)
%20 = icmp ne i64 %19, 0
br i1 %20, label %33, label %21
21: ; preds = %17
%22 = load %struct.ar_hdr*, %struct.ar_hdr** %6
%23 = call i64 @_ar_get_gid(%struct.ar_hdr* %22, i32* %10)
%24 = icmp ne i64 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = load %struct.ar_hdr*, %struct.ar_hdr** %6
%27 = call i64 @_ar_get_size(%struct.ar_hdr* %26, i64* %11)
%28 = icmp ne i64 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load %struct.ar_hdr*, %struct.ar_hdr** %6
%31 = call %struct.tm* @_ar_get_date(%struct.ar_hdr* %30)
store %struct.tm* %31, %struct.tm** %12
%32 = icmp eq %struct.tm* %31, null
br i1 %32, label %33, label %37
33: ; preds = %29, %25, %21, %17, %3
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %5
%36 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %35, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %53
37: ; preds = %29
%38 = getelementptr inbounds [24 x i8], [24 x i8]* %13, i64 0, i64 0
%39 = load %struct.tm*, %struct.tm** %12
%40 = call i64 @strftime(i8* %38, i32 24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @_ar_error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 1)
store i32 %43, i32* %4
br label %53
44: ; preds = %37
%45 = load i32, i32* %8
%46 = call i8* @_long_mode(i32 %45)
%47 = load i32, i32* %9
%48 = load i32, i32* %10
%49 = load i64, i64* %11
%50 = getelementptr inbounds [24 x i8], [24 x i8]* %13, i64 0, i64 0
%51 = load i8*, i8** %7
%52 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %46, i32 %47, i32 %48, i64 %49, i8* %50, i8* %51)
store i32 0, i32* %4
br label %53
53: ; preds = %44, %42, %33
%54 = load i32, i32* %4
ret i32 %54
}

LLVM IR (-O2):
%struct.ar_hdr = type { i32 }
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [5 x i8] c"ar: \00"
@.str.2 = [19 x i8] c": Invalid archive\0A\00"
@.str.3 = [15 x i8] c"%b %d %H:%M %Y\00"
@.str.4 = [9 x i8] c"strftime\00"
@.str.5 = [22 x i8] c"%s %u/%u %10zu %s %s\0A\00"
define i32 @_t_print_long(i8* %0, %struct.ar_hdr* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca [24 x i8]
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i64* %7 to i8*
%13 = getelementptr inbounds [24 x i8], [24 x i8]* %8, i64 0, i64 0
%14 = call i64 @_ar_get_mode(%struct.ar_hdr* %1, i32* %4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %3
%17 = call i64 @_ar_get_uid(%struct.ar_hdr* %1, i32* %5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = call i64 @_ar_get_gid(%struct.ar_hdr* %1, i32* %6)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = call i64 @_ar_get_size(%struct.ar_hdr* %1, i64* %7)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call %struct.tm* @_ar_get_date(%struct.ar_hdr* %1)
%27 = icmp eq %struct.tm* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25, %22, %19, %16, %3
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %43
31: ; preds = %25
%32 = call i64 @strftime(i8* %13, i32 24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %26)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @_ar_error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %43
36: ; preds = %31
%37 = load i32, i32* %4
%38 = call i8* @_long_mode(i32 %37)
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = load i64, i64* %7
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %38, i32 %39, i32 %40, i64 %41, i8* %13, i8* %2)
br label %43
43: ; preds = %36, %34, %28
%44 = phi i32 [ 1, %28 ], [ %35, %34 ], [ 0, %36 ]
ret i32 %44
}