#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ p_align;
  int /*<<< orphan*/ p_flags;
  int /*<<< orphan*/ p_memsz;
  int /*<<< orphan*/ p_filesz;
  int /*<<< orphan*/ p_paddr;
  int /*<<< orphan*/ p_vaddr;
  int /*<<< orphan*/ p_offset;
  int /*<<< orphan*/ p_type;
};
typedef TYPE_1__ Elf32_Phdr;

/* Variables and functions */
int /*<<< orphan*/ write_int(int /*<<< orphan*/);
void dump_phdr(Elf32_Phdr *phdr) {
  write_int(phdr->p_type);
  write_int(phdr->p_offset);
  write_int(phdr->p_vaddr);
  write_int(phdr->p_paddr);
  write_int(phdr->p_filesz);
  write_int(phdr->p_memsz);
  write_int(phdr->p_flags);
  write_int(phdr->p_align);
}


x86 assembly (clang, -O0):
<dump_phdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <write_int@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <write_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_phdr>:
push   %rbx
mov    %rdi,%rbx
mov    0x1c(%rdi),%edi
call   1030 <write_int@plt>
mov    0x18(%rbx),%edi
call   1030 <write_int@plt>
mov    0x14(%rbx),%edi
call   1030 <write_int@plt>
mov    0x10(%rbx),%edi
call   1030 <write_int@plt>
mov    0xc(%rbx),%edi
call   1030 <write_int@plt>
mov    0x8(%rbx),%edi
call   1030 <write_int@plt>
mov    0x4(%rbx),%edi
call   1030 <write_int@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1030 <write_int@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32, i32 }
define void @dump_phdr(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 7
%5 = load i32, i32* %4
%6 = call i32 @write_int(i32 %5)
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 6
%9 = load i32, i32* %8
%10 = call i32 @write_int(i32 %9)
%11 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 5
%13 = load i32, i32* %12
%14 = call i32 @write_int(i32 %13)
%15 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 4
%17 = load i32, i32* %16
%18 = call i32 @write_int(i32 %17)
%19 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %19, i32 0, i32 3
%21 = load i32, i32* %20
%22 = call i32 @write_int(i32 %21)
%23 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 2
%25 = load i32, i32* %24
%26 = call i32 @write_int(i32 %25)
%27 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%28 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %27, i32 0, i32 1
%29 = load i32, i32* %28
%30 = call i32 @write_int(i32 %29)
%31 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%32 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %31, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i32 @write_int(i32 %33)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32, i32 }
define void @dump_phdr(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 7
%3 = load i32, i32* %2
%4 = tail call i32 @write_int(i32 %3)
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 6
%6 = load i32, i32* %5
%7 = tail call i32 @write_int(i32 %6)
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 5
%9 = load i32, i32* %8
%10 = tail call i32 @write_int(i32 %9)
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 4
%12 = load i32, i32* %11
%13 = tail call i32 @write_int(i32 %12)
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 3
%15 = load i32, i32* %14
%16 = tail call i32 @write_int(i32 %15)
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 2
%18 = load i32, i32* %17
%19 = tail call i32 @write_int(i32 %18)
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%21 = load i32, i32* %20
%22 = tail call i32 @write_int(i32 %21)
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%24 = load i32, i32* %23
%25 = tail call i32 @write_int(i32 %24)
ret void
}