#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 *, ...);
int /*<<< orphan*/ show_mem(struct dirent const *, int);
void show_size(const struct dirent *test) {
  printf("=============================\n");
  printf("sizeof(struct dirent) = [%lu]\n", sizeof(struct dirent));
  printf("sizeof(test -> d_ino) = [%lu]\n", sizeof(test->d_ino));
  printf("sizeof(test -> d_off) = [%lu]\n", sizeof(test->d_off));
  printf("sizeof(test -> d_reclen) = [%lu]\n", sizeof(test->d_reclen));
  printf("sizeof(test -> d_type) = [%lu]\n", sizeof(test->d_type));
  printf("sizeof(test -> d_name) = [%lu]\n", sizeof(test->d_name));
  printf("d_ino address    = [%lu]\n", (long unsigned)&test->d_ino);
  printf("d_off address    = [%lu]\n", (long unsigned)&test->d_off);
  printf("d_reclen address = [%lu]\n", (long unsigned)&test->d_reclen);
  printf("d_type address   = [%lu]\n", (long unsigned)&test->d_type);
  printf("d_name address   = [%lu]\n", (long unsigned)&test->d_name);
  printf("binary data : \n");
  int iSize = sizeof(struct dirent);
  show_mem(test, iSize);
  printf("\n=============================\n");
}


x86 assembly (clang, -O0):
<show_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x101f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x10,%rsi
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0xc,%rsi
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xf10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <show_mem@plt>
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_size>:
push   %rbx
mov    %rdi,%rbx
lea    0x1016(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rbx),%rsi
lea    0xf02(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rbx),%rsi
lea    0xf0a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rbx),%rsi
lea    0xf12(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rbx),%rsi
lea    0xf1a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf26(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <show_mem@plt>
lea    0xf25(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
%struct.dirent = type { i32, i32, i32, i32, i32 }
@.str.1 = [31 x i8] c"sizeof(struct dirent) = [%lu]\0A\00"
@.str.2 = [31 x i8] c"sizeof(test -> d_ino) = [%lu]\0A\00"
@.str.3 = [31 x i8] c"sizeof(test -> d_off) = [%lu]\0A\00"
@.str.4 = [34 x i8] c"sizeof(test -> d_reclen) = [%lu]\0A\00"
@.str.5 = [32 x i8] c"sizeof(test -> d_type) = [%lu]\0A\00"
@.str.6 = [32 x i8] c"sizeof(test -> d_name) = [%lu]\0A\00"
@.str.7 = [26 x i8] c"d_ino address = [%lu]\0A\00"
@.str.8 = [26 x i8] c"d_off address = [%lu]\0A\00"
@.str.9 = [26 x i8] c"d_reclen address = [%lu]\0A\00"
@.str.10 = [26 x i8] c"d_type address = [%lu]\0A\00"
@.str.11 = [26 x i8] c"d_name address = [%lu]\0A\00"
@str = [30 x i8] c"=============================\00"
@str.14 = [15 x i8] c"binary data : \00"
@str.15 = [31 x i8] c"\0A=============================\00"
define void @show_size(%struct.dirent* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 20)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i64 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i64 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i64 4)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i64 4)
%9 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 4
%10 = ptrtoint i32* %9 to i64
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i64 %10)
%12 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 3
%13 = ptrtoint i32* %12 to i64
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 %13)
%15 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 2
%16 = ptrtoint i32* %15 to i64
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i64 %16)
%18 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%19 = ptrtoint i32* %18 to i64
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i64 %19)
%21 = ptrtoint %struct.dirent* %0 to i64
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 %21)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
%24 = tail call i32 @show_mem(%struct.dirent* %0, i32 20)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.15, i64 0, i64 0))
ret void
}