__attribute__((section(".after_vectors"))) void bss_init(unsigned int start,
                                                         unsigned int len) {
  unsigned int *pulDest = (unsigned int *)start;
  unsigned int loop;
  for (loop = 0; loop < len; loop = loop + 4)
    *pulDest++ = 0;
  for (loop = 0; loop < 128; loop = loop + 4) {
    *pulDest++ = 0xABBABABE;
  }
}


x86 assembly (clang, -O0):
<bss_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1147 <bss_init+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movl   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <bss_init+0x18>
movl   $0x0,-0x14(%rbp)
cmpl   $0x80,-0x14(%rbp)
jae    117e <bss_init+0x7e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movl   $0xabbababe,(%rax)
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <bss_init+0x4e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bss_init>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %esi,%esi
je     113a <bss_init+0x2a>
mov    %esi,%r14d
add    $0xffffffff,%r14d
and    $0xfffffffc,%r14d
lea    0x4(%r14),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    %r14,%rbx
add    $0x4,%rbx
movaps 0xebf(%rip),%xmm0
movups %xmm0,(%rbx)
movups %xmm0,0x10(%rbx)
movups %xmm0,0x20(%rbx)
movups %xmm0,0x30(%rbx)
movups %xmm0,0x40(%rbx)
movups %xmm0,0x50(%rbx)
movups %xmm0,0x60(%rbx)
movups %xmm0,0x70(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @bss_init(i32 %0, i32 %1) section ".after_vectors" {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
store i32 0, i32* %6
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %5
store i32 0, i32* %15
br label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = add i32 %18, 4
store i32 %19, i32* %6
br label %10
20: ; preds = %10
store i32 0, i32* %6
br label %21
21: ; preds = %27, %20
%22 = load i32, i32* %6
%23 = icmp ult i32 %22, 128
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32*, i32** %5
%26 = getelementptr inbounds i32, i32* %25, i32 1
store i32* %26, i32** %5
store i32 -1413825858, i32* %25
br label %27
27: ; preds = %24
%28 = load i32, i32* %6
%29 = add i32 %28, 4
store i32 %29, i32* %6
br label %21
30: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @bss_init(i32 %0, i32 %1) section ".after_vectors" {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
%5 = icmp eq i32 %1, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = inttoptr i64 %3 to i8*
%8 = add i32 %1, -1
%9 = lshr i32 %8, 2
%10 = zext i32 %9 to i64
%11 = shl nuw nsw i64 %10, 2
%12 = add nuw nsw i64 %11, 4
%13 = add nuw nsw i64 %10, 1
%14 = getelementptr i32, i32* %4, i64 %13
br label %15
15: ; preds = %6, %2
%16 = phi i32* [ %4, %2 ], [ %14, %6 ]
%17 = getelementptr inbounds i32, i32* %16, i64 4
%18 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %18
%19 = getelementptr inbounds i32, i32* %16, i64 8
%20 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %20
%21 = getelementptr inbounds i32, i32* %16, i64 12
%22 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %16, i64 16
%24 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %16, i64 20
%26 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %16, i64 24
%28 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %28
%29 = getelementptr inbounds i32, i32* %16, i64 28
%30 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %30
%31 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 -1413825858, i32 -1413825858, i32 -1413825858, i32 -1413825858>, <4 x i32>* %31
ret void
}