void hdlr_install(void) {
  extern unsigned char vec_stub_begin, vec_stub_end;
  unsigned char *dstptr = (unsigned char *)0x8000600;
  unsigned char *srcptr = &vec_stub_begin;
  while (srcptr < &vec_stub_end) {
    *dstptr++ = *srcptr++;
  }
  return;
}


x86 assembly (clang, -O0):
<hdlr_install>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8000600,%eax
mov    %rax,-0x8(%rbp)
mov    0x2ed4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    1150 <hdlr_install+0x50>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1118 <hdlr_install+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdlr_install>:
mov    0x2ee1(%rip),%rdi
cmp    0x2eca(%rip),%rdi
jae    12d2 <hdlr_install+0x1d2>
lea    0x1(%rdi),%r8
mov    0x2eb9(%rip),%r11
cmp    %r8,%r11
cmova  %r11,%r8
sub    %rdi,%r8
mov    $0x8000600,%esi
cmp    $0x8,%r8
jb     12c0 <hdlr_install+0x1c0>
mov    0x2ea9(%rip),%rdi
lea    0x1(%rdi),%rcx
cmp    %rcx,%r11
cmova  %r11,%rcx
cmp    $0x8000601,%rcx
jb     116e <hdlr_install+0x6e>
sub    %rdi,%rcx
add    $0x8000670,%rcx
add    $0xffffffffffffff90,%rcx
cmp    0x2e80(%rip),%rcx
ja     12c0 <hdlr_install+0x1c0>
mov    $0x8000670,%r10d
cmp    $0x20,%r8
jae    1181 <hdlr_install+0x81>
xor    %edx,%edx
jmp    1266 <hdlr_install+0x166>
mov    %r8,%rdx
and    $0xffffffffffffffe0,%rdx
lea    -0x20(%rdx),%rcx
mov    %rcx,%rdi
shr    $0x5,%rdi
add    $0x1,%rdi
mov    %edi,%r9d
and    $0x3,%r9d
cmp    $0x60,%rcx
jae    11a8 <hdlr_install+0xa8>
xor    %esi,%esi
jmp    1220 <hdlr_install+0x120>
and    $0xfffffffffffffffc,%rdi
xor    %esi,%esi
mov    0x2e33(%rip),%rcx
cs nopw 0x0(%rax,%rax,1)
nop
movups (%rcx,%rsi,1),%xmm0
movups 0x10(%rcx,%rsi,1),%xmm1
movaps %xmm0,-0x70(%r10,%rsi,1)
movaps %xmm1,-0x60(%r10,%rsi,1)
movups 0x20(%rcx,%rsi,1),%xmm0
movups 0x30(%rcx,%rsi,1),%xmm1
movaps %xmm0,-0x50(%r10,%rsi,1)
movaps %xmm1,-0x40(%r10,%rsi,1)
movups 0x40(%rcx,%rsi,1),%xmm0
movups 0x50(%rcx,%rsi,1),%xmm1
movaps %xmm0,-0x30(%r10,%rsi,1)
movaps %xmm1,-0x20(%r10,%rsi,1)
movups 0x60(%rcx,%rsi,1),%xmm0
movups 0x70(%rcx,%rsi,1),%xmm1
movaps %xmm0,-0x10(%r10,%rsi,1)
movaps %xmm1,(%r10,%rsi,1)
sub    $0xffffffffffffff80,%rsi
add    $0xfffffffffffffffc,%rdi
jne    11c0 <hdlr_install+0xc0>
test   %r9,%r9
je     125b <hdlr_install+0x15b>
lea    (%r10,%rsi,1),%rcx
add    $0xffffffffffffffa0,%rcx
add    $0x10,%rsi
add    0x2db0(%rip),%rsi
shl    $0x5,%r9
xor    %edi,%edi
xchg   %ax,%ax
movups -0x10(%rsi,%rdi,1),%xmm0
movups (%rsi,%rdi,1),%xmm1
movaps %xmm0,-0x10(%rcx,%rdi,1)
movaps %xmm1,(%rcx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r9
jne    1240 <hdlr_install+0x140>
cmp    %rdx,%r8
je     12d2 <hdlr_install+0x1d2>
test   $0x18,%r8b
je     12a9 <hdlr_install+0x1a9>
mov    0x2d7b(%rip),%r9
lea    0x1(%r9),%r8
cmp    %r8,%r11
cmova  %r11,%r8
sub    %r9,%r8
mov    %r8,%rcx
and    $0xfffffffffffffff8,%rcx
lea    (%r9,%rcx,1),%rdi
lea    (%r10,%rcx,1),%rsi
add    $0xffffffffffffff90,%rsi
xchg   %ax,%ax
mov    (%r9,%rdx,1),%rax
mov    %rax,-0x70(%r10,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rcx
jne    1290 <hdlr_install+0x190>
cmp    %rcx,%r8
jne    12c0 <hdlr_install+0x1c0>
jmp    12d2 <hdlr_install+0x1d2>
lea    (%r10,%rdx,1),%rsi
add    $0xffffffffffffff90,%rsi
add    0x2d30(%rip),%rdx
mov    %rdx,%rdi
nopl   0x0(%rax,%rax,1)
movzbl (%rdi),%eax
add    $0x1,%rdi
mov    %al,(%rsi)
add    $0x1,%rsi
cmp    %r11,%rdi
jb     12c0 <hdlr_install+0x1c0>
ret

LLVM IR (-O0):
@vec_stub_begin = external global i8
@vec_stub_end = external global i8
define void @hdlr_install() {
%1 = alloca i8*
%2 = alloca i8*
store i8* inttoptr (i64 134219264 to i8*), i8** %1
store i8* @vec_stub_begin, i8** %2
br label %3
3: ; preds = %6, %0
%4 = load i8*, i8** %2
%5 = icmp ult i8* %4, @vec_stub_end
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %2
%9 = load i8, i8* %7
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %1
store i8 %9, i8* %10
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
@vec_stub_begin = external global i8
@vec_stub_end = external global i8
define void @hdlr_install() {
br i1 icmp ult (i8* @vec_stub_begin, i8* @vec_stub_end), label %1, label %127
1: ; preds = %0
%2 = call i64 @llvm.umax.i64(i64 ptrtoint (i8* @vec_stub_end to i64), i64 add (i64 ptrtoint (i8* @vec_stub_begin to i64), i64 1))
%3 = sub i64 %2, ptrtoint (i8* @vec_stub_begin to i64)
%4 = icmp ult i64 %3, 8
br i1 %4, label %117, label %5
5: ; preds = %1
%6 = call i64 @llvm.umax.i64(i64 ptrtoint (i8* @vec_stub_end to i64), i64 add (i64 ptrtoint (i8* @vec_stub_begin to i64), i64 1))
%7 = sub i64 %6, ptrtoint (i8* @vec_stub_begin to i64)
%8 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %7
%9 = getelementptr i8, i8* @vec_stub_begin, i64 %7
%10 = icmp ugt i8* %9, inttoptr (i64 134219264 to i8*)
%11 = icmp ugt i8* %8, @vec_stub_begin
%12 = and i1 %10, %11
br i1 %12, label %117, label %13
13: ; preds = %5
%14 = icmp ult i64 %3, 32
br i1 %14, label %99, label %15
15: ; preds = %13
%16 = and i64 %3, -32
%17 = add i64 %16, -32
%18 = lshr exact i64 %17, 5
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 3
%21 = icmp ult i64 %17, 96
br i1 %21, label %73, label %22
22: ; preds = %15
%23 = and i64 %19, 1152921504606846972
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ 0, %22 ], [ %70, %24 ]
%26 = phi i64 [ 0, %22 ], [ %71, %24 ]
%27 = getelementptr i8, i8* @vec_stub_begin, i64 %25
%28 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %25
%29 = bitcast i8* %27 to <16 x i8>*
%30 = load <16 x i8>, <16 x i8>* %29
%31 = getelementptr i8, i8* %27, i64 16
%32 = bitcast i8* %31 to <16 x i8>*
%33 = load <16 x i8>, <16 x i8>* %32
%34 = bitcast i8* %28 to <16 x i8>*
store <16 x i8> %30, <16 x i8>* %34
%35 = getelementptr i8, i8* %28, i64 16
%36 = bitcast i8* %35 to <16 x i8>*
store <16 x i8> %33, <16 x i8>* %36
%37 = or i64 %25, 32
%38 = getelementptr i8, i8* @vec_stub_begin, i64 %37
%39 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %37
%40 = bitcast i8* %38 to <16 x i8>*
%41 = load <16 x i8>, <16 x i8>* %40
%42 = getelementptr i8, i8* %38, i64 16
%43 = bitcast i8* %42 to <16 x i8>*
%44 = load <16 x i8>, <16 x i8>* %43
%45 = bitcast i8* %39 to <16 x i8>*
store <16 x i8> %41, <16 x i8>* %45
%46 = getelementptr i8, i8* %39, i64 16
%47 = bitcast i8* %46 to <16 x i8>*
store <16 x i8> %44, <16 x i8>* %47
%48 = or i64 %25, 64
%49 = getelementptr i8, i8* @vec_stub_begin, i64 %48
%50 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %48
%51 = bitcast i8* %49 to <16 x i8>*
%52 = load <16 x i8>, <16 x i8>* %51
%53 = getelementptr i8, i8* %49, i64 16
%54 = bitcast i8* %53 to <16 x i8>*
%55 = load <16 x i8>, <16 x i8>* %54
%56 = bitcast i8* %50 to <16 x i8>*
store <16 x i8> %52, <16 x i8>* %56
%57 = getelementptr i8, i8* %50, i64 16
%58 = bitcast i8* %57 to <16 x i8>*
store <16 x i8> %55, <16 x i8>* %58
%59 = or i64 %25, 96
%60 = getelementptr i8, i8* @vec_stub_begin, i64 %59
%61 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %59
%62 = bitcast i8* %60 to <16 x i8>*
%63 = load <16 x i8>, <16 x i8>* %62
%64 = getelementptr i8, i8* %60, i64 16
%65 = bitcast i8* %64 to <16 x i8>*
%66 = load <16 x i8>, <16 x i8>* %65
%67 = bitcast i8* %61 to <16 x i8>*
store <16 x i8> %63, <16 x i8>* %67
%68 = getelementptr i8, i8* %61, i64 16
%69 = bitcast i8* %68 to <16 x i8>*
store <16 x i8> %66, <16 x i8>* %69
%70 = add nuw i64 %25, 128
%71 = add i64 %26, 4
%72 = icmp eq i64 %71, %23
br i1 %72, label %73, label %24
73: ; preds = %24, %15
%74 = phi i64 [ 0, %15 ], [ %70, %24 ]
%75 = icmp eq i64 %20, 0
br i1 %75, label %92, label %76
76: ; preds = %73, %76
%77 = phi i64 [ %89, %76 ], [ %74, %73 ]
%78 = phi i64 [ %90, %76 ], [ 0, %73 ]
%79 = getelementptr i8, i8* @vec_stub_begin, i64 %77
%80 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %77
%81 = bitcast i8* %79 to <16 x i8>*
%82 = load <16 x i8>, <16 x i8>* %81
%83 = getelementptr i8, i8* %79, i64 16
%84 = bitcast i8* %83 to <16 x i8>*
%85 = load <16 x i8>, <16 x i8>* %84
%86 = bitcast i8* %80 to <16 x i8>*
store <16 x i8> %82, <16 x i8>* %86
%87 = getelementptr i8, i8* %80, i64 16
%88 = bitcast i8* %87 to <16 x i8>*
store <16 x i8> %85, <16 x i8>* %88
%89 = add nuw i64 %77, 32
%90 = add i64 %78, 1
%91 = icmp eq i64 %90, %20
br i1 %91, label %92, label %76
92: ; preds = %76, %73
%93 = icmp eq i64 %3, %16
br i1 %93, label %127, label %94
94: ; preds = %92
%95 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %16
%96 = getelementptr i8, i8* @vec_stub_begin, i64 %16
%97 = and i64 %3, 24
%98 = icmp eq i64 %97, 0
br i1 %98, label %117, label %99
99: ; preds = %13, %94
%100 = phi i64 [ %16, %94 ], [ 0, %13 ]
%101 = call i64 @llvm.umax.i64(i64 ptrtoint (i8* @vec_stub_end to i64), i64 add (i64 ptrtoint (i8* @vec_stub_begin to i64), i64 1))
%102 = sub i64 %101, ptrtoint (i8* @vec_stub_begin to i64)
%103 = and i64 %102, -8
%104 = getelementptr i8, i8* @vec_stub_begin, i64 %103
%105 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %103
br label %106
106: ; preds = %106, %99
%107 = phi i64 [ %100, %99 ], [ %113, %106 ]
%108 = getelementptr i8, i8* @vec_stub_begin, i64 %107
%109 = getelementptr i8, i8* inttoptr (i64 134219264 to i8*), i64 %107
%110 = bitcast i8* %108 to <8 x i8>*
%111 = load <8 x i8>, <8 x i8>* %110
%112 = bitcast i8* %109 to <8 x i8>*
store <8 x i8> %111, <8 x i8>* %112
%113 = add nuw i64 %107, 8
%114 = icmp eq i64 %113, %103
br i1 %114, label %115, label %106
115: ; preds = %106
%116 = icmp eq i64 %102, %103
br i1 %116, label %127, label %117
117: ; preds = %5, %1, %94, %115
%118 = phi i8* [ @vec_stub_begin, %1 ], [ @vec_stub_begin, %5 ], [ %96, %94 ], [ %104, %115 ]
%119 = phi i8* [ inttoptr (i64 134219264 to i8*), %1 ], [ inttoptr (i64 134219264 to i8*), %5 ], [ %95, %94 ], [ %105, %115 ]
br label %120
120: ; preds = %117, %120
%121 = phi i8* [ %123, %120 ], [ %118, %117 ]
%122 = phi i8* [ %125, %120 ], [ %119, %117 ]
%123 = getelementptr inbounds i8, i8* %121, i64 1
%124 = load i8, i8* %121
%125 = getelementptr inbounds i8, i8* %122, i64 1
store i8 %124, i8* %122
%126 = icmp ult i8* %123, @vec_stub_end
br i1 %126, label %120, label %127
127: ; preds = %120, %92, %115, %0
ret void
}