void *task_stack_init(void *start_addr, void *data, void *stack_top) {
  unsigned long *pstk = stack_top;
  *pstk-- = (unsigned long)data;
  *pstk-- = (unsigned long)start_addr;
  *pstk-- = 0x000000ff;
  *pstk-- = 0x000000ff;
  *pstk-- = 0xAAAAAAAA;
  *pstk-- = 0xCCCCCCCC;
  *pstk-- = 0xDDDDDDDD;
  *pstk-- = 0xBBBBBBBB;
  *pstk-- = 0x00000000;
  *pstk-- = 0x11111111;
  *pstk-- = 0x22222222;
  *pstk-- = 0x33333333;
  *pstk-- = 0x00000010;
  *pstk-- = 0x00000010;
  *pstk-- = 0x00000010;
  *pstk = 0x00000010;
  return (void *)pstk;
}


x86 assembly (clang, -O0):
<task_stack_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffff8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffff8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0xff,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0xff,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
mov    $0xaaaaaaaa,%ecx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
mov    $0xcccccccc,%ecx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
mov    $0xdddddddd,%ecx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
mov    $0xbbbbbbbb,%ecx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x11111111,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x22222222,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x33333333,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x10,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x10,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x10,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x10,(%rax)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<task_stack_init>:
mov    %rsi,(%rdx)
mov    %rdi,-0x8(%rdx)
movaps 0xef2(%rip),%xmm0
movups %xmm0,-0x18(%rdx)
movaps 0xef7(%rip),%xmm0
movups %xmm0,-0x28(%rdx)
movaps 0xefc(%rip),%xmm0
movups %xmm0,-0x38(%rdx)
movaps 0xf01(%rip),%xmm0
movups %xmm0,-0x48(%rdx)
movaps 0xf06(%rip),%xmm0
movups %xmm0,-0x58(%rdx)
movaps 0xf0b(%rip),%xmm0
movups %xmm0,-0x68(%rdx)
movups %xmm0,-0x78(%rdx)
lea    -0x78(%rdx),%rax
ret

LLVM IR (-O0):
define i8* @task_stack_init(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i64*
store i64* %9, i64** %7
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %10 to i64
%12 = load i64*, i64** %7
%13 = getelementptr inbounds i64, i64* %12, i32 -1
store i64* %13, i64** %7
store i64 %11, i64* %12
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %14 to i64
%16 = load i64*, i64** %7
%17 = getelementptr inbounds i64, i64* %16, i32 -1
store i64* %17, i64** %7
store i64 %15, i64* %16
%18 = load i64*, i64** %7
%19 = getelementptr inbounds i64, i64* %18, i32 -1
store i64* %19, i64** %7
store i64 255, i64* %18
%20 = load i64*, i64** %7
%21 = getelementptr inbounds i64, i64* %20, i32 -1
store i64* %21, i64** %7
store i64 255, i64* %20
%22 = load i64*, i64** %7
%23 = getelementptr inbounds i64, i64* %22, i32 -1
store i64* %23, i64** %7
store i64 2863311530, i64* %22
%24 = load i64*, i64** %7
%25 = getelementptr inbounds i64, i64* %24, i32 -1
store i64* %25, i64** %7
store i64 3435973836, i64* %24
%26 = load i64*, i64** %7
%27 = getelementptr inbounds i64, i64* %26, i32 -1
store i64* %27, i64** %7
store i64 3722304989, i64* %26
%28 = load i64*, i64** %7
%29 = getelementptr inbounds i64, i64* %28, i32 -1
store i64* %29, i64** %7
store i64 3149642683, i64* %28
%30 = load i64*, i64** %7
%31 = getelementptr inbounds i64, i64* %30, i32 -1
store i64* %31, i64** %7
store i64 0, i64* %30
%32 = load i64*, i64** %7
%33 = getelementptr inbounds i64, i64* %32, i32 -1
store i64* %33, i64** %7
store i64 286331153, i64* %32
%34 = load i64*, i64** %7
%35 = getelementptr inbounds i64, i64* %34, i32 -1
store i64* %35, i64** %7
store i64 572662306, i64* %34
%36 = load i64*, i64** %7
%37 = getelementptr inbounds i64, i64* %36, i32 -1
store i64* %37, i64** %7
store i64 858993459, i64* %36
%38 = load i64*, i64** %7
%39 = getelementptr inbounds i64, i64* %38, i32 -1
store i64* %39, i64** %7
store i64 16, i64* %38
%40 = load i64*, i64** %7
%41 = getelementptr inbounds i64, i64* %40, i32 -1
store i64* %41, i64** %7
store i64 16, i64* %40
%42 = load i64*, i64** %7
%43 = getelementptr inbounds i64, i64* %42, i32 -1
store i64* %43, i64** %7
store i64 16, i64* %42
%44 = load i64*, i64** %7
store i64 16, i64* %44
%45 = load i64*, i64** %7
%46 = bitcast i64* %45 to i8*
ret i8* %46
}

LLVM IR (-O2):
define i8* @task_stack_init(i8* %0, i8* %1, i8* writeonly %2) {
%4 = bitcast i8* %2 to i64*
%5 = ptrtoint i8* %1 to i64
%6 = getelementptr inbounds i8, i8* %2, i64 -8
%7 = bitcast i8* %6 to i64*
store i64 %5, i64* %4
%8 = ptrtoint i8* %0 to i64
store i64 %8, i64* %7
%9 = getelementptr inbounds i8, i8* %2, i64 -24
%10 = bitcast i8* %9 to <2 x i64>*
store <2 x i64> <i64 255, i64 255>, <2 x i64>* %10
%11 = getelementptr inbounds i8, i8* %2, i64 -40
%12 = bitcast i8* %11 to <2 x i64>*
store <2 x i64> <i64 3435973836, i64 2863311530>, <2 x i64>* %12
%13 = getelementptr inbounds i8, i8* %2, i64 -56
%14 = bitcast i8* %13 to <2 x i64>*
store <2 x i64> <i64 3149642683, i64 3722304989>, <2 x i64>* %14
%15 = getelementptr inbounds i8, i8* %2, i64 -72
%16 = bitcast i8* %15 to <2 x i64>*
store <2 x i64> <i64 286331153, i64 0>, <2 x i64>* %16
%17 = getelementptr inbounds i8, i8* %2, i64 -88
%18 = bitcast i8* %17 to <2 x i64>*
store <2 x i64> <i64 858993459, i64 572662306>, <2 x i64>* %18
%19 = getelementptr inbounds i8, i8* %2, i64 -104
%20 = bitcast i8* %19 to <2 x i64>*
store <2 x i64> <i64 16, i64 16>, <2 x i64>* %20
%21 = getelementptr inbounds i8, i8* %2, i64 -120
%22 = bitcast i8* %21 to <2 x i64>*
store <2 x i64> <i64 16, i64 16>, <2 x i64>* %22
ret i8* %21
}