#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 {
  long st_mode;
  scalar_t__ st_ctime;
  scalar_t__ st_mtime;
  scalar_t__ st_atime;
  scalar_t__ st_blocks;
  scalar_t__ st_blksize;
  scalar_t__ st_size;
  scalar_t__ st_rdev;
  scalar_t__ st_gid;
  scalar_t__ st_uid;
  scalar_t__ st_nlink;
  scalar_t__ st_ino;
  scalar_t__ st_dev;
};

/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, long, ...);
int stat(char *, struct stat *);
char *strerror(int);
int main(int argc, char *argv[]) {
  struct stat stat_buf;
  int r;
  r = stat("file-stat.c", &stat_buf);
  if (r < 0) {
    int myerrno = errno;
    const char *error_str = strerror(myerrno);
    printf("errno=%d\nmessage=%s\n", myerrno, error_str);
    exit(1);
  }
  printf("st_dev=%ld\n", (long)stat_buf.st_dev);
  printf("st_ino=%ld\n", (long)stat_buf.st_ino);
  printf("st_mode=%o\n", stat_buf.st_mode);
  printf("st_nlink=%ld\n", (long)stat_buf.st_nlink);
  printf("st_uid=%ld\n", (long)stat_buf.st_uid);
  printf("st_gid=%ld\n", (long)stat_buf.st_gid);
  printf("st_rdev=%ld\n", (long)stat_buf.st_rdev);
  printf("st_size=%ld\n", (long)stat_buf.st_size);
  printf("st_blksize=%ld\n", (long)stat_buf.st_blksize);
  printf("st_blocks=%ld\n", (long)stat_buf.st_blocks);
  printf("st_atime=%ld\n", (long)stat_buf.st_atime);
  printf("st_mtime=%ld\n", (long)stat_buf.st_mtime);
  printf("st_ctime=%ld\n", (long)stat_buf.st_ctime);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    11b4 <main+0x74>
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%edi
call   1060 <strerror@plt>
mov    %rax,-0x88(%rbp)
movslq -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%rsi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rsi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%rsi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x70(%rbp),%rsi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
test   %eax,%eax
jns    1188 <main+0x48>
mov    0x2e7f(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1060 <strerror@plt>
movslq %ebx,%rsi
lea    0xe98(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x68(%rsp),%rsi
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x60(%rsp),%rsi
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x58(%rsp),%rsi
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x50(%rsp),%rsi
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x48(%rsp),%rsi
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x40(%rsp),%rsi
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x38(%rsp),%rsi
lea    0xe5f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x30(%rsp),%rsi
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x28(%rsp),%rsi
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%rsi
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [12 x i8] c"file-stat.c\00"
@errno = global i32 0
@.str.1 = [21 x i8] c"errno=%d\0Amessage=%s\0A\00"
@.str.2 = [12 x i8] c"st_dev=%ld\0A\00"
@.str.3 = [12 x i8] c"st_ino=%ld\0A\00"
@.str.4 = [12 x i8] c"st_mode=%o\0A\00"
@.str.5 = [14 x i8] c"st_nlink=%ld\0A\00"
@.str.6 = [12 x i8] c"st_uid=%ld\0A\00"
@.str.7 = [12 x i8] c"st_gid=%ld\0A\00"
@.str.8 = [13 x i8] c"st_rdev=%ld\0A\00"
@.str.9 = [13 x i8] c"st_size=%ld\0A\00"
@.str.10 = [16 x i8] c"st_blksize=%ld\0A\00"
@.str.11 = [15 x i8] c"st_blocks=%ld\0A\00"
@.str.12 = [14 x i8] c"st_atime=%ld\0A\00"
@.str.13 = [14 x i8] c"st_mtime=%ld\0A\00"
@.str.14 = [14 x i8] c"st_ctime=%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.stat* %6)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load i32, i32* @errno
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = call i8* @strerror(i32 %15)
store i8* %16, i8** %9
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = load i8*, i8** %9
%20 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %18, i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 12
%24 = load i64, i64* %23
%25 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %24)
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 11
%27 = load i64, i64* %26
%28 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 %27)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%30 = load i64, i64* %29
%31 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %30)
%32 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 10
%33 = load i64, i64* %32
%34 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %33)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 9
%36 = load i64, i64* %35
%37 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i64 %36)
%38 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 8
%39 = load i64, i64* %38
%40 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i64 %39)
%41 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 7
%42 = load i64, i64* %41
%43 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i64 %42)
%44 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 6
%45 = load i64, i64* %44
%46 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 %45)
%47 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 5
%48 = load i64, i64* %47
%49 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i64 %48)
%50 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 4
%51 = load i64, i64* %50
%52 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i64 %51)
%53 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 3
%54 = load i64, i64* %53
%55 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i64 %54)
%56 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 2
%57 = load i64, i64* %56
%58 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i64 %57)
%59 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%60 = load i64, i64* %59
%61 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i64 %60)
%62 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [12 x i8] c"file-stat.c\00"
@errno = global i32 0
@.str.1 = [21 x i8] c"errno=%d\0Amessage=%s\0A\00"
@.str.2 = [12 x i8] c"st_dev=%ld\0A\00"
@.str.3 = [12 x i8] c"st_ino=%ld\0A\00"
@.str.4 = [12 x i8] c"st_mode=%o\0A\00"
@.str.5 = [14 x i8] c"st_nlink=%ld\0A\00"
@.str.6 = [12 x i8] c"st_uid=%ld\0A\00"
@.str.7 = [12 x i8] c"st_gid=%ld\0A\00"
@.str.8 = [13 x i8] c"st_rdev=%ld\0A\00"
@.str.9 = [13 x i8] c"st_size=%ld\0A\00"
@.str.10 = [16 x i8] c"st_blksize=%ld\0A\00"
@.str.11 = [15 x i8] c"st_blocks=%ld\0A\00"
@.str.12 = [14 x i8] c"st_atime=%ld\0A\00"
@.str.13 = [14 x i8] c"st_mtime=%ld\0A\00"
@.str.14 = [14 x i8] c"st_ctime=%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = sext i32 %8 to i64
%11 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %10, i8* %9)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 12
%15 = load i64, i64* %14
%16 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %15)
%17 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 11
%18 = load i64, i64* %17
%19 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 %18)
%20 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%21 = load i64, i64* %20
%22 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %21)
%23 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 10
%24 = load i64, i64* %23
%25 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %24)
%26 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 9
%27 = load i64, i64* %26
%28 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i64 %27)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 8
%30 = load i64, i64* %29
%31 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i64 %30)
%32 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 7
%33 = load i64, i64* %32
%34 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i64 %33)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 6
%36 = load i64, i64* %35
%37 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 %36)
%38 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 5
%39 = load i64, i64* %38
%40 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i64 %39)
%41 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 4
%42 = load i64, i64* %41
%43 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i64 %42)
%44 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 3
%45 = load i64, i64* %44
%46 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i64 %45)
%47 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%48 = load i64, i64* %47
%49 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i64 %48)
%50 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%51 = load i64, i64* %50
%52 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i64 %51)
%53 = tail call i32 @exit(i32 0)
unreachable
}