unsigned char *rt_hw_stack_init(void *entry, void *param,
                                unsigned char *stack_addr, void *exit) {
  unsigned *stk;
  stk = (unsigned *)stack_addr;
  *stk = (unsigned)entry;
  *--stk = (unsigned)exit;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = 0;
  *--stk = (unsigned)param;
  *--stk = 0x13;
  *--stk = 0x13;
  return (unsigned char *)stk;
}


x86 assembly (clang, -O0):
<rt_hw_stack_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x4(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x13,-0x4(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x13,-0x4(%rax)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_hw_stack_init>:
mov    %edi,(%rdx)
mov    %ecx,-0x4(%rdx)
xorps  %xmm0,%xmm0
movups %xmm0,-0x34(%rdx)
movups %xmm0,-0x24(%rdx)
movups %xmm0,-0x14(%rdx)
mov    %esi,-0x38(%rdx)
movabs $0x1300000013,%rax
mov    %rax,-0x40(%rdx)
lea    -0x40(%rdx),%rax
ret

LLVM IR (-O0):
define i8* @rt_hw_stack_init(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %7
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %9
%12 = load i8*, i8** %5
%13 = ptrtoint i8* %12 to i32
%14 = load i32*, i32** %9
store i32 %13, i32* %14
%15 = load i8*, i8** %8
%16 = ptrtoint i8* %15 to i32
%17 = load i32*, i32** %9
%18 = getelementptr inbounds i32, i32* %17, i32 -1
store i32* %18, i32** %9
store i32 %16, i32* %18
%19 = load i32*, i32** %9
%20 = getelementptr inbounds i32, i32* %19, i32 -1
store i32* %20, i32** %9
store i32 0, i32* %20
%21 = load i32*, i32** %9
%22 = getelementptr inbounds i32, i32* %21, i32 -1
store i32* %22, i32** %9
store i32 0, i32* %22
%23 = load i32*, i32** %9
%24 = getelementptr inbounds i32, i32* %23, i32 -1
store i32* %24, i32** %9
store i32 0, i32* %24
%25 = load i32*, i32** %9
%26 = getelementptr inbounds i32, i32* %25, i32 -1
store i32* %26, i32** %9
store i32 0, i32* %26
%27 = load i32*, i32** %9
%28 = getelementptr inbounds i32, i32* %27, i32 -1
store i32* %28, i32** %9
store i32 0, i32* %28
%29 = load i32*, i32** %9
%30 = getelementptr inbounds i32, i32* %29, i32 -1
store i32* %30, i32** %9
store i32 0, i32* %30
%31 = load i32*, i32** %9
%32 = getelementptr inbounds i32, i32* %31, i32 -1
store i32* %32, i32** %9
store i32 0, i32* %32
%33 = load i32*, i32** %9
%34 = getelementptr inbounds i32, i32* %33, i32 -1
store i32* %34, i32** %9
store i32 0, i32* %34
%35 = load i32*, i32** %9
%36 = getelementptr inbounds i32, i32* %35, i32 -1
store i32* %36, i32** %9
store i32 0, i32* %36
%37 = load i32*, i32** %9
%38 = getelementptr inbounds i32, i32* %37, i32 -1
store i32* %38, i32** %9
store i32 0, i32* %38
%39 = load i32*, i32** %9
%40 = getelementptr inbounds i32, i32* %39, i32 -1
store i32* %40, i32** %9
store i32 0, i32* %40
%41 = load i32*, i32** %9
%42 = getelementptr inbounds i32, i32* %41, i32 -1
store i32* %42, i32** %9
store i32 0, i32* %42
%43 = load i8*, i8** %6
%44 = ptrtoint i8* %43 to i32
%45 = load i32*, i32** %9
%46 = getelementptr inbounds i32, i32* %45, i32 -1
store i32* %46, i32** %9
store i32 %44, i32* %46
%47 = load i32*, i32** %9
%48 = getelementptr inbounds i32, i32* %47, i32 -1
store i32* %48, i32** %9
store i32 19, i32* %48
%49 = load i32*, i32** %9
%50 = getelementptr inbounds i32, i32* %49, i32 -1
store i32* %50, i32** %9
store i32 19, i32* %50
%51 = load i32*, i32** %9
%52 = bitcast i32* %51 to i8*
ret i8* %52
}

LLVM IR (-O2):
define i8* @rt_hw_stack_init(i8* %0, i8* %1, i8* writeonly %2, i8* %3) {
%5 = bitcast i8* %2 to i32*
%6 = ptrtoint i8* %0 to i64
%7 = trunc i64 %6 to i32
store i32 %7, i32* %5
%8 = ptrtoint i8* %3 to i64
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds i8, i8* %2, i64 -4
%11 = bitcast i8* %10 to i32*
store i32 %9, i32* %11
%12 = getelementptr inbounds i8, i8* %2, i64 -52
%13 = ptrtoint i8* %1 to i64
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds i8, i8* %2, i64 -56
%16 = bitcast i8* %15 to i32*
store i32 %14, i32* %16
%17 = getelementptr inbounds i8, i8* %2, i64 -60
%18 = bitcast i8* %17 to i32*
store i32 19, i32* %18
%19 = getelementptr inbounds i8, i8* %2, i64 -64
%20 = bitcast i8* %19 to i32*
store i32 19, i32* %20
ret i8* %19
}