#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 vm86_regs {
  int eax;
  int ebx;
  int ecx;
  int edx;
  int esi;
  int edi;
  int /*<<< orphan*/ gs;
  int /*<<< orphan*/ fs;
  int /*<<< orphan*/ ss;
  int /*<<< orphan*/ es;
  int /*<<< orphan*/ ds;
  int /*<<< orphan*/ cs;
  int /*<<< orphan*/ eflags;
  int /*<<< orphan*/ eip;
  int /*<<< orphan*/ esp;
  int /*<<< orphan*/ ebp;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, int,
                           int, int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void dump_regs(struct vm86_regs *r) {
  fprintf(stderr,
          "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
          "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n"
          "EIP=%08lx EFL=%08lx\n"
          "CS=%04x DS=%04x ES=%04x SS=%04x FS=%04x GS=%04x\n",
          r->eax, r->ebx, r->ecx, r->edx, r->esi, r->edi, r->ebp, r->esp,
          r->eip, r->eflags, r->cs, r->ds, r->es, r->ss, r->fs, r->gs);
}


x86 assembly (clang, -O0):
<dump_regs>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,-0x30(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x30(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%eax
mov    -0x30(%rbp),%rsi
mov    0x14(%rsi),%esi
mov    %esi,-0x40(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x3c(%rsi),%esi
mov    %esi,-0x3c(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x38(%rsi),%esi
mov    %esi,-0x38(%rbp)
mov    -0x30(%rbp),%rsi
mov    0x34(%rsi),%r13d
mov    -0x30(%rbp),%rsi
mov    0x30(%rsi),%r12d
mov    -0x30(%rbp),%rsi
mov    0x2c(%rsi),%r15d
mov    -0x30(%rbp),%rsi
mov    0x28(%rsi),%r14d
mov    -0x30(%rbp),%rsi
mov    0x24(%rsi),%ebx
mov    -0x30(%rbp),%rsi
mov    0x20(%rsi),%r11d
mov    -0x30(%rbp),%rsi
mov    0x1c(%rsi),%r10d
mov    -0x30(%rbp),%rsi
mov    0x18(%rsi),%esi
mov    %esi,-0x34(%rbp)
lea    0xe48(%rip),%rsi
mov    %eax,(%rsp)
mov    -0x40(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x3c(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x38(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x34(%rbp),%eax
mov    %r13d,0x20(%rsp)
mov    %r12d,0x28(%rsp)
mov    %r15d,0x30(%rsp)
mov    %r14d,0x38(%rsp)
mov    %ebx,0x40(%rsp)
mov    %r11d,0x48(%rsp)
mov    %r10d,0x50(%rsp)
mov    %eax,0x58(%rsp)
call   1030 <fprintf@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_regs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
mov    (%rdi),%edx
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%r8d
mov    0xc(%rdi),%r9d
mov    0x10(%rdi),%eax
mov    %rax,0x20(%rsp)
mov    0x14(%rdi),%eax
mov    %rax,0x18(%rsp)
mov    0x3c(%rdi),%eax
mov    %rax,0x10(%rsp)
mov    0x38(%rdi),%eax
mov    %rax,0x8(%rsp)
mov    0x34(%rdi),%r12d
mov    0x30(%rdi),%r13d
mov    0x2c(%rdi),%r15d
mov    0x28(%rdi),%ebp
mov    0x24(%rdi),%r10d
mov    0x20(%rdi),%eax
mov    0x1c(%rdi),%r11d
mov    0x18(%rdi),%ebx
lea    0xe88(%rip),%r14
mov    %esi,%edi
mov    %r14,%rsi
push   %rbx
push   %r11
push   %rax
push   %r10
push   %rbp
push   %r15
push   %r13
push   %r12
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1030 <fprintf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.vm86_regs = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [149 x i8] c"EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\0AESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\0AEIP=%08lx EFL=%08lx\0ACS=%04x DS=%04x ES=%04x SS=%04x FS=%04x GS=%04x\0A\00"
define void @dump_regs(%struct.vm86_regs* %0) {
%2 = alloca %struct.vm86_regs*
store %struct.vm86_regs* %0, %struct.vm86_regs** %2
%3 = load i32, i32* @stderr
%4 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%5 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%8 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%11 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %10, i32 0, i32 2
%12 = load i32, i32* %11
%13 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%14 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %13, i32 0, i32 3
%15 = load i32, i32* %14
%16 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%17 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %16, i32 0, i32 4
%18 = load i32, i32* %17
%19 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%20 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %19, i32 0, i32 5
%21 = load i32, i32* %20
%22 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%23 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %22, i32 0, i32 15
%24 = load i32, i32* %23
%25 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%26 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %25, i32 0, i32 14
%27 = load i32, i32* %26
%28 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%29 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %28, i32 0, i32 13
%30 = load i32, i32* %29
%31 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%32 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %31, i32 0, i32 12
%33 = load i32, i32* %32
%34 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%35 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %34, i32 0, i32 11
%36 = load i32, i32* %35
%37 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%38 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %37, i32 0, i32 10
%39 = load i32, i32* %38
%40 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%41 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %40, i32 0, i32 9
%42 = load i32, i32* %41
%43 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%44 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %43, i32 0, i32 8
%45 = load i32, i32* %44
%46 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%47 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %46, i32 0, i32 7
%48 = load i32, i32* %47
%49 = load %struct.vm86_regs*, %struct.vm86_regs** %2
%50 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %49, i32 0, i32 6
%51 = load i32, i32* %50
%52 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %9, i32 %12, i32 %15, i32 %18, i32 %21, i32 %24, i32 %27, i32 %30, i32 %33, i32 %36, i32 %39, i32 %42, i32 %45, i32 %48, i32 %51)
ret void
}

LLVM IR (-O2):
%struct.vm86_regs = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [149 x i8] c"EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\0AESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\0AEIP=%08lx EFL=%08lx\0ACS=%04x DS=%04x ES=%04x SS=%04x FS=%04x GS=%04x\0A\00"
define void @dump_regs(%struct.vm86_regs* nocapture %0) {
%2 = load i32, i32* @stderr
%3 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 15
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 14
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 13
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 12
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 11
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 10
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 9
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 8
%30 = load i32, i32* %29
%31 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 7
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.vm86_regs, %struct.vm86_regs* %0, i64 0, i32 6
%34 = load i32, i32* %33
%35 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28, i32 %30, i32 %32, i32 %34)
ret void
}