#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 /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_size;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
  int /*<<< orphan*/ st_nlink;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
char *gid_to_name(int /*<<< orphan*/);
int /*<<< orphan*/ mode_to_letters(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
char *uid_to_name(int /*<<< orphan*/);
extern void show_stat_info(char *filename, struct stat *stat_buf_p) {
  char letters[11];
  mode_to_letters(stat_buf_p->st_mode, letters);
  printf("%s ", letters);
  printf("%ld ", stat_buf_p->st_nlink);
  char *uid_name = uid_to_name(stat_buf_p->st_uid);
  printf("%-10s ", uid_name);
  char *gid_name = gid_to_name(stat_buf_p->st_gid);
  printf("%-10s ", gid_name);
  printf("%ld ", stat_buf_p->st_size);
  char *time_str = ctime(&(stat_buf_p->st_mtime)) + 4;
  printf("%.12s ", time_str);
  printf("%s ", filename);
  printf("\n");
}


x86 assembly (clang, -O0):
<show_stat_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edi
lea    -0x1b(%rbp),%rsi
call   1070 <mode_to_letters@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
call   1060 <uid_to_name@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
call   1050 <gid_to_name@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ctime@plt>
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_stat_info>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r15
mov    0x14(%rsi),%edi
lea    0x5(%rsp),%r12
mov    %r12,%rsi
call   1080 <mode_to_letters@plt>
lea    0xe76(%rip),%r14
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%esi
lea    0xe63(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx),%edi
call   1070 <uid_to_name@plt>
lea    0xe4f(%rip),%r13
mov    %r13,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%edi
call   1060 <gid_to_name@plt>
mov    %r13,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <ctime@plt>
lea    0x4(%rax),%rsi
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32, i32, i32 }
@.str = [4 x i8] c"%s \00"
@.str.1 = [5 x i8] c"%ld \00"
@.str.2 = [7 x i8] c"%-10s \00"
@.str.3 = [7 x i8] c"%.12s \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @show_stat_info(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
%5 = alloca [11 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%9 = load %struct.stat*, %struct.stat** %4
%10 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 5
%11 = load i32, i32* %10
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%13 = call i32 @mode_to_letters(i32 %11, i8* %12)
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load %struct.stat*, %struct.stat** %4
%17 = getelementptr inbounds %struct.stat, %struct.stat* %16, i32 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load %struct.stat*, %struct.stat** %4
%21 = getelementptr inbounds %struct.stat, %struct.stat* %20, i32 0, i32 3
%22 = load i32, i32* %21
%23 = call i8* @uid_to_name(i32 %22)
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load %struct.stat*, %struct.stat** %4
%27 = getelementptr inbounds %struct.stat, %struct.stat* %26, i32 0, i32 2
%28 = load i32, i32* %27
%29 = call i8* @gid_to_name(i32 %28)
store i8* %29, i8** %7
%30 = load i8*, i8** %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load %struct.stat*, %struct.stat** %4
%33 = getelementptr inbounds %struct.stat, %struct.stat* %32, i32 0, i32 1
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load %struct.stat*, %struct.stat** %4
%37 = getelementptr inbounds %struct.stat, %struct.stat* %36, i32 0, i32 0
%38 = call i8* @ctime(i32* %37)
%39 = getelementptr inbounds i8, i8* %38, i64 4
store i8* %39, i8** %8
%40 = load i8*, i8** %8
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = load i8*, i8** %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32 }
@.str = [4 x i8] c"%s \00"
@.str.1 = [5 x i8] c"%ld \00"
@.str.2 = [7 x i8] c"%-10s \00"
@.str.3 = [7 x i8] c"%.12s \00"
define void @show_stat_info(i8* %0, %struct.stat* %1) {
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 5
%6 = load i32, i32* %5
%7 = call i32 @mode_to_letters(i32 %6, i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 4
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 3
%13 = load i32, i32* %12
%14 = call i8* @uid_to_name(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 2
%17 = load i32, i32* %16
%18 = call i8* @gid_to_name(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%24 = call i8* @ctime(i32* %23)
%25 = getelementptr inbounds i8, i8* %24, i64 4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%28 = call i32 @putchar(i32 10)
ret void
}