#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;
  scalar_t__ st_size;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
  scalar_t__ 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*/);
void show_file_info(char *fname, struct stat *info) {
  char mode_str[11];
  mode_to_letters(info->st_mode, mode_str);
  printf("%s ", mode_str);
  printf("%4d ", (int)info->st_nlink);
  printf("%-8s ", uid_to_name(info->st_uid));
  printf("%-8s ", gid_to_name(info->st_gid));
  printf("%-8ld ", (long)info->st_size);
  printf("%.12s  ", 4 + ctime(&info->st_mtime));
  printf("%s\n", fname);
}


x86 assembly (clang, -O0):
<show_file_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%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    0x18(%rax),%rax
mov    %eax,%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edi
call   1060 <uid_to_name@plt>
mov    %rax,%rsi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <gid_to_name@plt>
mov    %rax,%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
add    $0x4,%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_file_info>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x20(%rsi),%edi
lea    0x5(%rsp),%r15
mov    %r15,%rsi
call   1080 <mode_to_letters@plt>
lea    0xe7a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rbx),%esi
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rbx),%edi
call   1070 <uid_to_name@plt>
lea    0xe59(%rip),%r15
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%edi
call   1060 <gid_to_name@plt>
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xe32(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <ctime@plt>
lea    0x4(%rax),%rsi
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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