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

/* Variables and functions */
int /*<<< orphan*/ debug(int, char *, ...);
int __instw_printdirent(struct dirent *entry) {
  if (entry != NULL) {
    debug(4,
          "entry(%p) {\n"
          "\td_ino     : %ld\n"
          "\td_off     : %ld\n"
          "\td_reclen  : %d\n"
          "\td_type    : %d\n"
          "\td_name    : \"%.*s\"\n",
          entry, entry->d_ino, entry->d_off, entry->d_reclen,
          (int)entry->d_type, (int)entry->d_reclen, (char *)(entry->d_name));
  } else {
    debug(4, "entry(null) \n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<__instw_printdirent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1185 <__instw_printdirent+0x75>
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r9
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %eax,%r11d
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %eax,%r10d
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x4,%edi
lea    0xe95(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1030 <debug@plt>
jmp    1198 <__instw_printdirent+0x88>
mov    $0x4,%edi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <debug@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__instw_printdirent>:
push   %rax
test   %rdi,%rdi
je     114b <__instw_printdirent+0x3b>
mov    %rdi,%rdx
mov    0x1c(%rdi),%ecx
mov    0x18(%rdi),%r8d
mov    0x8(%rdi),%r9
mov    0x10(%rdi),%r10d
sub    $0x8,%rsp
lea    0xecd(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
push   (%rdx)
push   %r9
push   %r10
call   1030 <debug@plt>
add    $0x20,%rsp
jmp    115e <__instw_printdirent+0x4e>
lea    0xf11(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1030 <debug@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.dirent = type { i64, i64, i64, i32, i32 }
@.str = [99 x i8] c"entry(%p) {\0A\09d_ino : %ld\0A\09d_off : %ld\0A\09d_reclen : %d\0A\09d_type : %d\0A\09d_name : \22%.*s\22\0A\00"
@.str.1 = [14 x i8] c"entry(null) \0A\00"
define i32 @__instw_printdirent(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = icmp ne %struct.dirent* %3, null
br i1 %4, label %5, label %29
5: ; preds = %1
%6 = load %struct.dirent*, %struct.dirent** %2
%7 = load %struct.dirent*, %struct.dirent** %2
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %7, i32 0, i32 4
%9 = load i32, i32* %8
%10 = load %struct.dirent*, %struct.dirent** %2
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %10, i32 0, i32 3
%12 = load i32, i32* %11
%13 = load %struct.dirent*, %struct.dirent** %2
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %13, i32 0, i32 1
%15 = load i64, i64* %14
%16 = load %struct.dirent*, %struct.dirent** %2
%17 = getelementptr inbounds %struct.dirent, %struct.dirent* %16, i32 0, i32 2
%18 = load i64, i64* %17
%19 = trunc i64 %18 to i32
%20 = load %struct.dirent*, %struct.dirent** %2
%21 = getelementptr inbounds %struct.dirent, %struct.dirent* %20, i32 0, i32 1
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = load %struct.dirent*, %struct.dirent** %2
%25 = getelementptr inbounds %struct.dirent, %struct.dirent* %24, i32 0, i32 0
%26 = load i64, i64* %25
%27 = inttoptr i64 %26 to i8*
%28 = call i32 (i32, i8*, ...) @debug(i32 4, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), %struct.dirent* %6, i32 %9, i32 %12, i64 %15, i32 %19, i32 %23, i8* %27)
br label %31
29: ; preds = %1
%30 = call i32 (i32, i8*, ...) @debug(i32 4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %5
ret i32 0
}

LLVM IR (-O2):
%struct.dirent = type { i64, i64, i64, i32, i32 }
@.str = [99 x i8] c"entry(%p) {\0A\09d_ino : %ld\0A\09d_off : %ld\0A\09d_reclen : %d\0A\09d_type : %d\0A\09d_name : \22%.*s\22\0A\00"
@.str.1 = [14 x i8] c"entry(null) \0A\00"
define i32 @__instw_printdirent(%struct.dirent* %0) {
%2 = icmp eq %struct.dirent* %0, null
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 4
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 3
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%9 = load i64, i64* %8
%10 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 2
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = trunc i64 %9 to i32
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%15 = load i64, i64* %14
%16 = inttoptr i64 %15 to i8*
%17 = tail call i32 (i32, i8*, ...) @debug(i32 4, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), %struct.dirent* %0, i32 %5, i32 %7, i64 %9, i32 %12, i32 %13, i8* %16)
br label %20
18: ; preds = %1
%19 = tail call i32 (i32, i8*, ...) @debug(i32 4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %3
ret i32 0
}