#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);
int stat(char *, struct stat *);
int main(int argc, char **argv) {
  struct stat st;
  int res = stat(argv[1], &st);
  printf("res: %i\n", res);
  printf("dev: %i\n", st.st_dev);
  printf("ino: %i\n", st.st_ino);
  printf("mode: %i\n", st.st_mode);
  printf("nlink: %i\n", st.st_nlink);
  printf("uid: %i\n", st.st_uid);
  printf("gid: %i\n", st.st_gid);
  printf("rdev: %i\n", st.st_rdev);
  printf("size: %i\n", st.st_size);
  printf("blksize: %i\n", st.st_blksize);
  printf("blocks: %i\n", st.st_blocks);
  printf("atime: %i\n", st.st_atime);
  printf("mtime: %i\n", st.st_mtime);
  printf("ctime: %i\n", st.st_ctime);
  return 0;
}


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),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%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>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%rsp),%esi
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
lea    0xe6a(%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 = [9 x i8] c"res: %i\0A\00"
@.str.1 = [9 x i8] c"dev: %i\0A\00"
@.str.2 = [9 x i8] c"ino: %i\0A\00"
@.str.3 = [10 x i8] c"mode: %i\0A\00"
@.str.4 = [11 x i8] c"nlink: %i\0A\00"
@.str.5 = [9 x i8] c"uid: %i\0A\00"
@.str.6 = [9 x i8] c"gid: %i\0A\00"
@.str.7 = [10 x i8] c"rdev: %i\0A\00"
@.str.8 = [10 x i8] c"size: %i\0A\00"
@.str.9 = [13 x i8] c"blksize: %i\0A\00"
@.str.10 = [12 x i8] c"blocks: %i\0A\00"
@.str.11 = [11 x i8] c"atime: %i\0A\00"
@.str.12 = [11 x i8] c"mtime: %i\0A\00"
@.str.13 = [11 x i8] c"ctime: %i\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 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @stat(i8* %10, %struct.stat* %6)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 2
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 3
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 4
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 5
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 6
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 7
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 8
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 9
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 10
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 11
%48 = load i32, i32* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 12
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i32 %51)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [9 x i8] c"res: %i\0A\00"
@.str.1 = [9 x i8] c"dev: %i\0A\00"
@.str.2 = [9 x i8] c"ino: %i\0A\00"
@.str.3 = [10 x i8] c"mode: %i\0A\00"
@.str.4 = [11 x i8] c"nlink: %i\0A\00"
@.str.5 = [9 x i8] c"uid: %i\0A\00"
@.str.6 = [9 x i8] c"gid: %i\0A\00"
@.str.7 = [10 x i8] c"rdev: %i\0A\00"
@.str.8 = [10 x i8] c"size: %i\0A\00"
@.str.9 = [13 x i8] c"blksize: %i\0A\00"
@.str.10 = [12 x i8] c"blocks: %i\0A\00"
@.str.11 = [11 x i8] c"atime: %i\0A\00"
@.str.12 = [11 x i8] c"mtime: %i\0A\00"
@.str.13 = [11 x i8] c"ctime: %i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @stat(i8* %6, %struct.stat* %3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%13 = load i32, i32* %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%16 = load i32, i32* %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 3
%19 = load i32, i32* %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 4
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 5
%25 = load i32, i32* %24
%26 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 6
%28 = load i32, i32* %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 7
%31 = load i32, i32* %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 8
%34 = load i32, i32* %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 9
%37 = load i32, i32* %36
%38 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 10
%40 = load i32, i32* %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 11
%43 = load i32, i32* %42
%44 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 12
%46 = load i32, i32* %45
%47 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i32 %46)
ret i32 0
}