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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat s;
  int ret;
  ret = stat("/", &s);
  if (ret < 0) {
    perror("stat");
    exit(1);
  }
  printf("device    : 0x%x\n", (unsigned int)s.st_dev);
  printf("inode     : %d\n", (int)s.st_ino);
  printf("mode      : 0x%x\n", s.st_mode);
  printf("nlink     : %d\n", s.st_nlink);
  printf("uid       : %d\n", s.st_uid);
  printf("gid       : %d\n", s.st_gid);
  printf("rdev      : 0x%x\n", (unsigned int)s.st_rdev);
  printf("size      : %ld\n", s.st_size);
  printf("blksize   : %ld\n", s.st_blksize);
  printf("blocks    : %ld\n", s.st_blocks);
  printf("atime     : %ld\n", s.st_atime);
  printf("mtime     : %ld\n", s.st_mtime);
  printf("ctime     : %ld\n", s.st_ctime);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    1189 <main+0x49>
lea    0xe88(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %eax,%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xeb5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
test   %eax,%eax
jns    116f <main+0x2f>
lea    0xea2(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x40(%rsp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64 }
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"stat\00"
@.str.2 = [18 x i8] c"device : 0x%x\0A\00"
@.str.3 = [16 x i8] c"inode : %d\0A\00"
@.str.4 = [18 x i8] c"mode : 0x%x\0A\00"
@.str.5 = [16 x i8] c"nlink : %d\0A\00"
@.str.6 = [16 x i8] c"uid : %d\0A\00"
@.str.7 = [16 x i8] c"gid : %d\0A\00"
@.str.8 = [18 x i8] c"rdev : 0x%x\0A\00"
@.str.9 = [17 x i8] c"size : %ld\0A\00"
@.str.10 = [17 x i8] c"blksize : %ld\0A\00"
@.str.11 = [17 x i8] c"blocks : %ld\0A\00"
@.str.12 = [17 x i8] c"atime : %ld\0A\00"
@.str.13 = [17 x i8] c"mtime : %ld\0A\00"
@.str.14 = [17 x i8] c"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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @stat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %6)
store i32 %8, i32* %7
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 12
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 11
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 2
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 3
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 10
%36 = load i64, i64* %35
%37 = trunc i64 %36 to i32
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 4
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 5
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 6
%46 = load i32, i32* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 7
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 8
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 9
%55 = load i32, i32* %54
%56 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 %55)
%57 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64 }
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"stat\00"
@.str.2 = [18 x i8] c"device : 0x%x\0A\00"
@.str.3 = [16 x i8] c"inode : %d\0A\00"
@.str.4 = [18 x i8] c"mode : 0x%x\0A\00"
@.str.5 = [16 x i8] c"nlink : %d\0A\00"
@.str.6 = [16 x i8] c"uid : %d\0A\00"
@.str.7 = [16 x i8] c"gid : %d\0A\00"
@.str.8 = [18 x i8] c"rdev : 0x%x\0A\00"
@.str.9 = [17 x i8] c"size : %ld\0A\00"
@.str.10 = [17 x i8] c"blksize : %ld\0A\00"
@.str.11 = [17 x i8] c"blocks : %ld\0A\00"
@.str.12 = [17 x i8] c"atime : %ld\0A\00"
@.str.13 = [17 x i8] c"mtime : %ld\0A\00"
@.str.14 = [17 x i8] c"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 ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 12
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 11
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%20 = load i32, i32* %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%23 = load i32, i32* %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%26 = load i32, i32* %25
%27 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 3
%29 = load i32, i32* %28
%30 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 10
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
%34 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 4
%36 = load i32, i32* %35
%37 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 5
%39 = load i32, i32* %38
%40 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 6
%42 = load i32, i32* %41
%43 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 7
%45 = load i32, i32* %44
%46 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 8
%48 = load i32, i32* %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 9
%51 = load i32, i32* %50
%52 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 %51)
%53 = tail call i32 @exit(i32 0)
unreachable
}