#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int,
                          unsigned int, unsigned int, unsigned int,
                          unsigned int, unsigned int);
void print_stack(unsigned int ebp, unsigned int esp, unsigned int edi,
                 unsigned int esi, unsigned int ebx, unsigned int edx,
                 unsigned int ecx, unsigned int eax) {
  printf("General register values: EAX=%x EBX=%x ECX=%x EDX=%x ESI=%x EDI=%x "
         "ESP=%x EBP=%x\n",
         eax, ebx, ecx, edx, esi, edi, esp, ebp);
}


x86 assembly (clang, -O0):
<print_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0xc(%rbp),%r11d
mov    -0x8(%rbp),%r10d
mov    -0x4(%rbp),%eax
lea    0xeab(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_stack>:
push   %rbx
mov    %ecx,%eax
mov    %edx,%r10d
mov    %esi,%r11d
mov    %edi,%ebx
mov    0x18(%rsp),%esi
mov    0x10(%rsp),%ecx
sub    $0x8,%rsp
lea    0xed2(%rip),%rdi
mov    %r8d,%edx
mov    %r9d,%r8d
mov    %eax,%r9d
push   %rbx
push   %r11
push   %r10
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [82 x i8] c"General register values: EAX=%x EBX=%x ECX=%x EDX=%x ESI=%x EDI=%x ESP=%x EBP=%x\0A\00"
define void @print_stack(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %16
%18 = load i32, i32* %13
%19 = load i32, i32* %15
%20 = load i32, i32* %14
%21 = load i32, i32* %12
%22 = load i32, i32* %11
%23 = load i32, i32* %10
%24 = load i32, i32* %9
%25 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [82 x i8] c"General register values: EAX=%x EBX=%x ECX=%x EDX=%x ESI=%x EDI=%x ESP=%x EBP=%x\0A\00"
define void @print_stack(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %4, i32 %6, i32 %5, i32 %3, i32 %2, i32 %1, i32 %0)
ret void
}