#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_mode;
  int st_uid;
  int st_gid;
  int /*<<< orphan*/ st_ctime;
  int /*<<< orphan*/ st_mtime;
  scalar_t__ st_ino;
  scalar_t__ st_size;
};
typedef int /*<<< orphan*/ link;

/* Variables and functions */
int S_IFMT;
scalar_t__ S_ISLNK(int);
char *ctime(int /*<<< orphan*/ *);
char *disp_mode(int);
int /*<<< orphan*/ free(char *);
char *get_filetype(int);
scalar_t__ lstat(char *, struct stat *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ readlink(char *, char *, int);
int main(int argc, char **argv) {
  int i;
  for (i = 1; i < argc; i++) {
    struct stat buf;
    if (lstat(argv[i], &buf) == 0) {
      if (S_ISLNK(buf.st_mode)) {
        char link[80];
        readlink(argv[i], link, sizeof(link));
        printf("  File: '%s' -> '%s'\n", argv[i], link);
      } else {
        printf("  File: '%s'\n", argv[i]);
      }
      printf("  Size: %d\n", (int)buf.st_size);
      printf(" Inode: %u\n", (unsigned int)buf.st_ino);
      printf("  Type: %s\n", get_filetype(buf.st_mode));
      char *mode = disp_mode(buf.st_mode);
      printf("Access: (%o/%s)		uid: %d		gid: %d\n",
             buf.st_mode & ~S_IFMT, mode, buf.st_uid, buf.st_gid);
      free(mode);
      printf("Modify: %s", ctime(&buf.st_mtime));
      printf("Change: %s", ctime(&buf.st_ctime));
    } else {
      printf("%s: file not found.\n", argv[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1331 <main+0x1b1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <lstat@plt>
cmp    $0x0,%rax
jne    1304 <main+0x184>
mov    -0x40(%rbp),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1220 <main+0xa0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x50,%edx
call   1050 <readlink@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x90(%rbp),%rdx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    123a <main+0xba>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%esi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %eax,%esi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%edi
call   10a0 <get_filetype@plt>
mov    %rax,%rsi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%edi
call   1090 <disp_mode@plt>
mov    %rax,-0x98(%rbp)
mov    -0x40(%rbp),%esi
mov    0x2d4c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
mov    -0x98(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%r8d
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
lea    -0x40(%rbp),%rdi
add    $0x10,%rdi
call   1060 <ctime@plt>
mov    %rax,%rsi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x40(%rbp),%rdi
add    $0xc,%rdi
call   1060 <ctime@plt>
mov    %rax,%rsi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    131e <main+0x19e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1323 <main+0x1a3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a0 <main+0x20>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
cmp    $0x2,%edi
jl     12e8 <main+0x168>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%r14d
lea    0x8(%rsp),%r12
lea    0xecf(%rip),%r15
jmp    11db <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx,%r14,8),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     12e8 <main+0x168>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   1080 <lstat@plt>
test   %rax,%rax
jne    11c0 <main+0x40>
mov    0x8(%rsp),%edi
call   1040 <S_ISLNK@plt>
test   %rax,%rax
je     1227 <main+0xa7>
mov    (%rbx,%r14,8),%rdi
lea    0x30(%rsp),%rbp
mov    %rbp,%rsi
mov    $0x50,%edx
call   1050 <readlink@plt>
mov    (%rbx,%r14,8),%rsi
lea    0xde5(%rip),%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1239 <main+0xb9>
mov    (%rbx,%r14,8),%rsi
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xde0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xdda(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%edi
call   10a0 <get_filetype@plt>
lea    0xdcf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%edi
call   1090 <disp_mode@plt>
mov    %rax,%rbp
mov    0x2d56(%rip),%rax
mov    (%rax),%esi
not    %esi
and    0x8(%rsp),%esi
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%r8d
lea    0xda6(%rip),%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0x18(%rsp),%rdi
call   1060 <ctime@plt>
lea    0xda6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x14(%rsp),%rdi
call   1060 <ctime@plt>
lea    0xd96(%rip),%rdi
mov    %rax,%rsi
jmp    11c7 <main+0x47>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32, i32, i64, i64 }
@.str = [22 x i8] c" File: '%s' -> '%s'\0A\00"
@.str.1 = [14 x i8] c" File: '%s'\0A\00"
@.str.2 = [12 x i8] c" Size: %d\0A\00"
@.str.3 = [12 x i8] c" Inode: %u\0A\00"
@.str.4 = [12 x i8] c" Type: %s\0A\00"
@.str.5 = [35 x i8] c"Access: (%o/%s)\09\09uid: %d\09\09gid: %d\0A\00"
@S_IFMT = global i32 0
@.str.6 = [11 x i8] c"Modify: %s\00"
@.str.7 = [11 x i8] c"Change: %s\00"
@.str.8 = [21 x i8] c"%s: file not found.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.stat
%8 = alloca [80 x i8]
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %10
10: ; preds = %92, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %95
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @lstat(i8* %19, %struct.stat* %7)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %84
22: ; preds = %14
%23 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%24 = load i32, i32* %23
%25 = call i64 @S_ISLNK(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %42
27: ; preds = %22
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%34 = call i32 @readlink(i8* %32, i8* %33, i32 80)
%35 = load i8**, i8*** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %39, i8* %40)
br label %49
42: ; preds = %22
%43 = load i8**, i8*** %5
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %42, %27
%50 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 6
%51 = load i64, i64* %50
%52 = trunc i64 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 5
%55 = load i64, i64* %54
%56 = trunc i64 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%59 = load i32, i32* %58
%60 = call i8* @get_filetype(i32 %59)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%63 = load i32, i32* %62
%64 = call i8* @disp_mode(i32 %63)
store i8* %64, i8** %9
%65 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%66 = load i32, i32* %65
%67 = load i32, i32* @S_IFMT
%68 = xor i32 %67, -1
%69 = and i32 %66, %68
%70 = load i8*, i8** %9
%71 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 2
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %69, i8* %70, i32 %72, i32 %74)
%76 = load i8*, i8** %9
%77 = call i32 @free(i8* %76)
%78 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 4
%79 = call i8* @ctime(i32* %78)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %79)
%81 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 3
%82 = call i8* @ctime(i32* %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %82)
br label %91
84: ; preds = %14
%85 = load i8**, i8*** %5
%86 = load i32, i32* %6
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %85, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %84, %49
br label %92
92: ; preds = %91
%93 = load i32, i32* %6
%94 = add nsw i32 %93, 1
store i32 %94, i32* %6
br label %10
95: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i64, i64 }
@.str = [22 x i8] c" File: '%s' -> '%s'\0A\00"
@.str.1 = [14 x i8] c" File: '%s'\0A\00"
@.str.2 = [12 x i8] c" Size: %d\0A\00"
@.str.3 = [12 x i8] c" Inode: %u\0A\00"
@.str.4 = [12 x i8] c" Type: %s\0A\00"
@.str.5 = [35 x i8] c"Access: (%o/%s)\09\09uid: %d\09\09gid: %d\0A\00"
@S_IFMT = global i32 0
@.str.6 = [11 x i8] c"Modify: %s\00"
@.str.7 = [11 x i8] c"Change: %s\00"
@.str.8 = [21 x i8] c"%s: file not found.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca [80 x i8]
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %65
6: ; preds = %2
%7 = bitcast %struct.stat* %3 to i8*
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 6
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 5
%12 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%14 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 4
%15 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 3
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %6, %62
%18 = phi i64 [ 1, %6 ], [ %63, %62 ]
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @lstat(i8* %20, %struct.stat* %3)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %59
23: ; preds = %17
%24 = load i32, i32* %8
%25 = call i64 @S_ISLNK(i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %23
%28 = load i8*, i8** %19
%29 = call i32 @readlink(i8* %28, i8* %9, i32 80)
%30 = load i8*, i8** %19
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %30, i8* %9)
br label %35
32: ; preds = %23
%33 = load i8*, i8** %19
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %27
%36 = load i64, i64* %10
%37 = trunc i64 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = load i64, i64* %11
%40 = trunc i64 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %8
%43 = call i8* @get_filetype(i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %43)
%45 = load i32, i32* %8
%46 = call i8* @disp_mode(i32 %45)
%47 = load i32, i32* %8
%48 = load i32, i32* @S_IFMT
%49 = xor i32 %48, -1
%50 = and i32 %47, %49
%51 = load i32, i32* %12
%52 = load i32, i32* %13
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %50, i8* %46, i32 %51, i32 %52)
%54 = call i32 @free(i8* %46)
%55 = call i8* @ctime(i32* %14)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %55)
%57 = call i8* @ctime(i32* %15)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %57)
br label %62
59: ; preds = %17
%60 = load i8*, i8** %19
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %59, %35
%63 = add nuw nsw i64 %18, 1
%64 = icmp eq i64 %63, %16
br i1 %64, label %65, label %17
65: ; preds = %62, %2
ret i32 0
}