#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 dirent {
  int /*<<< orphan*/ d_name;
  int /*<<< orphan*/ d_type;
  int /*<<< orphan*/ d_reclen;
  int /*<<< orphan*/ d_off;
  int /*<<< orphan*/ d_ino;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
void show_dir_struct(struct dirent *x) {
  printf("sizeof(struct dirent) = [%lu]\n", sizeof(struct dirent));
  printf("address start    : [%lu]\n", (unsigned long)x);
  printf("address d_ino    : [%lu]\n", (unsigned long)&x->d_ino);
  printf("address d_off    : [%lu]\n", (unsigned long)&x->d_off);
  printf("address d_reclen : [%lu]\n", (unsigned long)&x->d_reclen);
  printf("address d_type   : [%lu]\n", (unsigned long)&x->d_type);
  printf("address d_name   : [%lu]\n", (unsigned long)&x->d_name);
}


x86 assembly (clang, -O0):
<show_dir_struct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x10,%rsi
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0xc,%rsi
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xeff(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf09(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_dir_struct>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x10(%rbx),%rsi
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
lea    0xc(%rbx),%rsi
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
lea    0x8(%rbx),%rsi
lea    0xf0e(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rbx),%rsi
lea    0xf18(%rip),%rdi
call   1030 <printf@plt>
lea    0xf26(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.dirent = type { i32, i32, i32, i32, i32 }
@.str = [31 x i8] c"sizeof(struct dirent) = [%lu]\0A\00"
@.str.1 = [26 x i8] c"address start : [%lu]\0A\00"
@.str.2 = [26 x i8] c"address d_ino : [%lu]\0A\00"
@.str.3 = [26 x i8] c"address d_off : [%lu]\0A\00"
@.str.4 = [26 x i8] c"address d_reclen : [%lu]\0A\00"
@.str.5 = [26 x i8] c"address d_type : [%lu]\0A\00"
@.str.6 = [26 x i8] c"address d_name : [%lu]\0A\00"
define void @show_dir_struct(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 20)
%4 = load %struct.dirent*, %struct.dirent** %2
%5 = ptrtoint %struct.dirent* %4 to i64
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %5)
%7 = load %struct.dirent*, %struct.dirent** %2
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %7, i32 0, i32 4
%9 = ptrtoint i32* %8 to i64
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 %9)
%11 = load %struct.dirent*, %struct.dirent** %2
%12 = getelementptr inbounds %struct.dirent, %struct.dirent* %11, i32 0, i32 3
%13 = ptrtoint i32* %12 to i64
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %13)
%15 = load %struct.dirent*, %struct.dirent** %2
%16 = getelementptr inbounds %struct.dirent, %struct.dirent* %15, i32 0, i32 2
%17 = ptrtoint i32* %16 to i64
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 %17)
%19 = load %struct.dirent*, %struct.dirent** %2
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i32 0, i32 1
%21 = ptrtoint i32* %20 to i64
%22 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i64 %21)
%23 = load %struct.dirent*, %struct.dirent** %2
%24 = getelementptr inbounds %struct.dirent, %struct.dirent* %23, i32 0, i32 0
%25 = ptrtoint i32* %24 to i64
%26 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 %25)
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i32, i32, i32, i32, i32 }
@.str = [31 x i8] c"sizeof(struct dirent) = [%lu]\0A\00"
@.str.1 = [26 x i8] c"address start : [%lu]\0A\00"
@.str.2 = [26 x i8] c"address d_ino : [%lu]\0A\00"
@.str.3 = [26 x i8] c"address d_off : [%lu]\0A\00"
@.str.4 = [26 x i8] c"address d_reclen : [%lu]\0A\00"
@.str.5 = [26 x i8] c"address d_type : [%lu]\0A\00"
@.str.6 = [26 x i8] c"address d_name : [%lu]\0A\00"
define void @show_dir_struct(%struct.dirent* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 20)
%3 = ptrtoint %struct.dirent* %0 to i64
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %3)
%5 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 4
%6 = ptrtoint i32* %5 to i64
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 %6)
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 3
%9 = ptrtoint i32* %8 to i64
%10 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %9)
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 2
%12 = ptrtoint i32* %11 to i64
%13 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 %12)
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%15 = ptrtoint i32* %14 to i64
%16 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i64 %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 %3)
ret void
}