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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  struct stat st;
  if (stat(filename, &st) == 0) {
    printf("st_dev: %d\n", st.st_dev);
    printf("st_ino: %d\n", st.st_ino);
    printf("st_mode: %x\n", st.st_mode);
    printf("st_nlink: %d\n", st.st_nlink);
    printf("st_uid: %d\n", st.st_uid);
    printf("st_gid: %d\n", st.st_gid);
    printf("st_rdev: %d\n", st.st_rdev);
    printf("st_size: %d\n", st.st_size);
    printf("st_blksize: %ld\n", st.st_blksize);
    printf("st_blocks: %ld\n", st.st_blocks);
    printf("st_atime: %d\n", st.st_atime);
    printf("st_mtime: %d\n", st.st_mtime);
    printf("st_ctime: %d\n", st.st_ctime);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jne    121c <main+0xfc>
mov    -0x50(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
jne    1208 <main+0xe8>
mov    (%rsp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

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