#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 {
  scalar_t__ st_mtime;
};

/* Variables and functions */
scalar_t__ lstat(char *, struct stat *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  struct stat buf;
  if (argc != 2) {
    printf("Usage: %s <file>\n", argv[0]);
    return 1;
  }
  if (lstat(argv[1], &buf) < 0) {
    perror("lstat");
    return 1;
  }
  printf("%u\n", (unsigned)buf.st_mtime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1171 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bf <main+0x8f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <lstat@plt>
cmp    $0x0,%rax
jge    11a4 <main+0x74>
lea    0xe7f(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bf <main+0x8f>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    1163 <main+0x33>
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
call   1040 <lstat@plt>
test   %rax,%rax
js     1181 <main+0x51>
mov    0x8(%rsp),%esi
lea    0xec0(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1179 <main+0x49>
mov    (%rsi),%rsi
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
call   1050 <perror@plt>
jmp    1174 <main+0x44>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@.str.1 = [6 x i8] c"lstat\00"
@.str.2 = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %27
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @lstat(i8* %17, %struct.stat* %6)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %27
22: ; preds = %14
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%24 = load i64, i64* %23
%25 = trunc i64 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %25)
store i32 0, i32* %3
br label %27
27: ; preds = %22, %20, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@.str.1 = [6 x i8] c"lstat\00"
@.str.2 = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %21
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @lstat(i8* %11, %struct.stat* %3)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %21
16: ; preds = %9
%17 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%18 = load i64, i64* %17
%19 = trunc i64 %18 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %16, %14, %6
%22 = phi i32 [ 1, %6 ], [ 1, %14 ], [ 0, %16 ]
ret i32 %22
}