void denormalize(char *buf, double d, int size, int endian) {
  short pom = 0;
  if (size == 1) {
    pom = (d + 0.5) * 255;
  } else if (size == 2) {
    pom = d * 65535;
  }
  int i;
  for (i = 0; i < size; i++) {
    buf[i] = (char)((pom >> i * 8) & 0xff);
  }
}


x86 assembly (clang, -O0):
<denormalize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movw   $0x0,-0x1a(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    114d <denormalize+0x4d>
movsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xed4(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0x1a(%rbp)
jmp    1175 <denormalize+0x75>
cmpl   $0x2,-0x14(%rbp)
jne    1170 <denormalize+0x70>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0x1a(%rbp)
jmp    1175 <denormalize+0x75>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b4 <denormalize+0xb4>
movswl -0x1a(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117c <denormalize+0x7c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<denormalize>:
cmp    $0x2,%esi
je     1120 <denormalize+0x20>
cmp    $0x1,%esi
jne    112e <denormalize+0x2e>
addsd  0xef6(%rip),%xmm0
mulsd  0xef6(%rip),%xmm0
cvttsd2si %xmm0,%eax
jmp    1136 <denormalize+0x36>
mulsd  0xed8(%rip),%xmm0
cvttsd2si %xmm0,%eax
jmp    1136 <denormalize+0x36>
jl     1a04 <denormalize+0x904>
xor    %eax,%eax
movswl %ax,%r9d
mov    %esi,%edx
cmp    $0x10,%esi
jae    1148 <denormalize+0x48>
xor    %esi,%esi
jmp    19e3 <denormalize+0x8e3>
mov    %edx,%esi
and    $0xfffffff0,%esi
movd   %r9d,%xmm0
pshufd $0x0,%xmm0,%xmm11
lea    -0x10(%rsi),%rcx
mov    %rcx,%rax
shr    $0x4,%rax
add    $0x1,%rax
mov    %eax,%r8d
and    $0x3,%r8d
cmp    $0x30,%rcx
jae    119f <denormalize+0x9f>
movdqa 0xea3(%rip),%xmm12
movdqa 0xeaa(%rip),%xmm13
movdqa 0xeb1(%rip),%xmm15
movdqa 0xeb8(%rip),%xmm10
xor    %ecx,%ecx
jmp    1823 <denormalize+0x723>
and    $0xfffffffffffffffc,%rax
movdqa 0xe74(%rip),%xmm12
movdqa 0xe7b(%rip),%xmm13
movdqa 0xe82(%rip),%xmm15
movdqa 0xe89(%rip),%xmm10
xor    %ecx,%ecx
movaps 0xe8f(%rip),%xmm14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa %xmm10,-0x38(%rsp)
movdqa %xmm15,-0x28(%rsp)
movdqa %xmm12,-0x18(%rsp)
movdqa -0x38(%rsp),%xmm10
pslld  $0x3,%xmm10
movdqa %xmm15,%xmm8
pslld  $0x3,%xmm8
movdqa %xmm13,%xmm9
movdqa %xmm12,%xmm1
pslld  $0x3,%xmm1
pshuflw $0xfe,%xmm1,%xmm0
movdqa %xmm11,%xmm3
psrad  %xmm0,%xmm3
pslld  $0x3,%xmm9
pshuflw $0x54,%xmm1,%xmm0
movdqa %xmm11,%xmm5
psrad  %xmm0,%xmm5
pshufd $0xee,%xmm1,%xmm0
pshuflw $0xfe,%xmm0,%xmm4
movdqa %xmm11,%xmm7
psrad  %xmm4,%xmm7
punpcklqdq %xmm3,%xmm5
pshuflw $0x54,%xmm0,%xmm0
movdqa %xmm11,%xmm3
psrad  %xmm0,%xmm3
punpckhqdq %xmm7,%xmm3
pshuflw $0xfe,%xmm9,%xmm0
movdqa %xmm11,%xmm7
psrad  %xmm0,%xmm7
shufps $0xcc,%xmm3,%xmm5
pshuflw $0x54,%xmm9,%xmm0
movdqa %xmm11,%xmm4
psrad  %xmm0,%xmm4
pshufd $0xee,%xmm9,%xmm0
pshuflw $0xfe,%xmm0,%xmm15
movdqa %xmm11,%xmm3
psrad  %xmm15,%xmm3
punpcklqdq %xmm7,%xmm4
pshuflw $0x54,%xmm0,%xmm0
movdqa %xmm11,%xmm7
psrad  %xmm0,%xmm7
punpckhqdq %xmm3,%xmm7
pshuflw $0xfe,%xmm8,%xmm0
movdqa %xmm11,%xmm3
psrad  %xmm0,%xmm3
shufps $0xcc,%xmm7,%xmm4
pshuflw $0x54,%xmm8,%xmm7
movdqa %xmm11,%xmm0
psrad  %xmm7,%xmm0
pshufd $0xee,%xmm8,%xmm7
pshuflw $0xfe,%xmm7,%xmm15
movdqa %xmm11,%xmm12
psrad  %xmm15,%xmm12
punpcklqdq %xmm3,%xmm0
pshuflw $0x54,%xmm7,%xmm3
movdqa %xmm11,%xmm7
psrad  %xmm3,%xmm7
punpckhqdq %xmm12,%xmm7
pshuflw $0xfe,%xmm10,%xmm12
movdqa %xmm11,%xmm3
psrad  %xmm12,%xmm3
shufps $0xcc,%xmm7,%xmm0
pshuflw $0x54,%xmm10,%xmm12
movdqa %xmm11,%xmm7
psrad  %xmm12,%xmm7
pshufd $0xee,%xmm10,%xmm12
pshuflw $0xfe,%xmm12,%xmm15
movdqa %xmm13,%xmm2
movdqa %xmm11,%xmm13
psrad  %xmm15,%xmm13
punpcklqdq %xmm3,%xmm7
pshuflw $0x54,%xmm12,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
punpckhqdq %xmm13,%xmm6
shufps $0xcc,%xmm6,%xmm7
andps  %xmm14,%xmm7
andps  %xmm14,%xmm0
packuswb %xmm0,%xmm7
andps  %xmm14,%xmm4
andps  %xmm14,%xmm5
packuswb %xmm5,%xmm4
packuswb %xmm4,%xmm7
movdqu %xmm7,(%rdi,%rcx,1)
movdqa %xmm10,%xmm12
movdqa 0xce3(%rip),%xmm4
paddd  %xmm4,%xmm12
movdqa %xmm8,%xmm15
paddd  %xmm4,%xmm15
movdqa %xmm9,%xmm3
movdqa %xmm1,%xmm0
paddd  %xmm4,%xmm0
pshuflw $0xfe,%xmm0,%xmm5
movdqa %xmm11,%xmm6
psrad  %xmm5,%xmm6
paddd  %xmm4,%xmm3
pshuflw $0x54,%xmm0,%xmm7
movdqa %xmm11,%xmm5
psrad  %xmm7,%xmm5
pshufd $0xee,%xmm0,%xmm0
pshuflw $0xfe,%xmm0,%xmm7
movdqa %xmm11,%xmm4
psrad  %xmm7,%xmm4
punpcklqdq %xmm6,%xmm5
pshuflw $0x54,%xmm0,%xmm0
movdqa %xmm11,%xmm6
psrad  %xmm0,%xmm6
punpckhqdq %xmm4,%xmm6
pshuflw $0xfe,%xmm3,%xmm0
movdqa %xmm11,%xmm4
psrad  %xmm0,%xmm4
shufps $0xcc,%xmm6,%xmm5
pshuflw $0x54,%xmm3,%xmm6
movdqa %xmm11,%xmm0
psrad  %xmm6,%xmm0
pshufd $0xee,%xmm3,%xmm3
pshuflw $0xfe,%xmm3,%xmm6
movdqa %xmm11,%xmm7
psrad  %xmm6,%xmm7
punpcklqdq %xmm4,%xmm0
pshuflw $0x54,%xmm3,%xmm3
movdqa %xmm11,%xmm4
psrad  %xmm3,%xmm4
punpckhqdq %xmm7,%xmm4
pshuflw $0xfe,%xmm15,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
shufps $0xcc,%xmm4,%xmm0
pshuflw $0x54,%xmm15,%xmm3
movdqa %xmm11,%xmm7
psrad  %xmm3,%xmm7
pshufd $0xee,%xmm15,%xmm3
movdqa -0x28(%rsp),%xmm15
pshuflw $0xfe,%xmm3,%xmm13
movdqa %xmm11,%xmm4
psrad  %xmm13,%xmm4
punpcklqdq %xmm6,%xmm7
pshuflw $0x54,%xmm3,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
punpckhqdq %xmm4,%xmm6
pshuflw $0xfe,%xmm12,%xmm3
movdqa %xmm11,%xmm4
psrad  %xmm3,%xmm4
shufps $0xcc,%xmm6,%xmm7
pshuflw $0x54,%xmm12,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
pshufd $0xee,%xmm12,%xmm13
pshuflw $0xfe,%xmm13,%xmm12
movdqa %xmm11,%xmm3
psrad  %xmm12,%xmm3
punpcklqdq %xmm4,%xmm6
pshuflw $0x54,%xmm13,%xmm4
movdqa %xmm2,%xmm13
movdqa %xmm11,%xmm2
psrad  %xmm4,%xmm2
punpckhqdq %xmm3,%xmm2
shufps $0xcc,%xmm2,%xmm6
andps  %xmm14,%xmm6
andps  %xmm14,%xmm7
packuswb %xmm7,%xmm6
andps  %xmm14,%xmm0
andps  %xmm14,%xmm5
packuswb %xmm5,%xmm0
packuswb %xmm0,%xmm6
movdqu %xmm6,0x10(%rdi,%rcx,1)
movdqa %xmm10,%xmm12
movdqa 0xb69(%rip),%xmm4
paddd  %xmm4,%xmm12
movdqa %xmm8,%xmm7
paddd  %xmm4,%xmm7
movdqa %xmm9,%xmm2
movdqa %xmm1,%xmm0
paddd  %xmm4,%xmm0
pshuflw $0xfe,%xmm0,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
paddd  %xmm4,%xmm2
pshuflw $0x54,%xmm0,%xmm3
movdqa %xmm11,%xmm5
psrad  %xmm3,%xmm5
pshufd $0xee,%xmm0,%xmm0
pshuflw $0xfe,%xmm0,%xmm3
movdqa %xmm11,%xmm4
psrad  %xmm3,%xmm4
punpcklqdq %xmm6,%xmm5
pshuflw $0x54,%xmm0,%xmm0
movdqa %xmm11,%xmm3
psrad  %xmm0,%xmm3
punpckhqdq %xmm4,%xmm3
pshuflw $0xfe,%xmm2,%xmm0
movdqa %xmm11,%xmm4
psrad  %xmm0,%xmm4
shufps $0xcc,%xmm3,%xmm5
pshuflw $0x54,%xmm2,%xmm3
movdqa %xmm11,%xmm0
psrad  %xmm3,%xmm0
pshufd $0xee,%xmm2,%xmm2
pshuflw $0xfe,%xmm2,%xmm3
movdqa %xmm11,%xmm6
psrad  %xmm3,%xmm6
punpcklqdq %xmm4,%xmm0
pshuflw $0x54,%xmm2,%xmm2
movdqa %xmm11,%xmm3
psrad  %xmm2,%xmm3
punpckhqdq %xmm6,%xmm3
pshuflw $0xfe,%xmm7,%xmm2
movdqa %xmm11,%xmm4
psrad  %xmm2,%xmm4
shufps $0xcc,%xmm3,%xmm0
pshuflw $0x54,%xmm7,%xmm2
movdqa %xmm11,%xmm3
psrad  %xmm2,%xmm3
pshufd $0xee,%xmm7,%xmm2
pshuflw $0xfe,%xmm2,%xmm6
movdqa %xmm11,%xmm7
psrad  %xmm6,%xmm7
punpcklqdq %xmm4,%xmm3
pshuflw $0x54,%xmm2,%xmm2
movdqa %xmm11,%xmm4
psrad  %xmm2,%xmm4
punpckhqdq %xmm7,%xmm4
pshuflw $0xfe,%xmm12,%xmm2
movdqa %xmm11,%xmm6
psrad  %xmm2,%xmm6
shufps $0xcc,%xmm4,%xmm3
pshuflw $0x54,%xmm12,%xmm2
movdqa %xmm11,%xmm4
psrad  %xmm2,%xmm4
pshufd $0xee,%xmm12,%xmm2
pshuflw $0xfe,%xmm2,%xmm12
movdqa %xmm11,%xmm7
psrad  %xmm12,%xmm7
movdqa -0x18(%rsp),%xmm12
punpcklqdq %xmm6,%xmm4
pshuflw $0x54,%xmm2,%xmm2
movdqa %xmm11,%xmm6
psrad  %xmm2,%xmm6
punpckhqdq %xmm7,%xmm6
shufps $0xcc,%xmm6,%xmm4
andps  %xmm14,%xmm4
andps  %xmm14,%xmm3
packuswb %xmm3,%xmm4
andps  %xmm14,%xmm0
andps  %xmm14,%xmm5
packuswb %xmm5,%xmm0
packuswb %xmm0,%xmm4
movdqu %xmm4,0x20(%rdi,%rcx,1)
movdqa 0xa00(%rip),%xmm3
paddd  %xmm3,%xmm10
paddd  %xmm3,%xmm8
paddd  %xmm3,%xmm1
pshuflw $0xfe,%xmm1,%xmm0
movdqa %xmm11,%xmm2
psrad  %xmm0,%xmm2
paddd  %xmm3,%xmm9
pshuflw $0x54,%xmm1,%xmm0
movdqa %xmm11,%xmm5
psrad  %xmm0,%xmm5
pshufd $0xee,%xmm1,%xmm0
pshuflw $0xfe,%xmm0,%xmm1
movdqa %xmm11,%xmm3
psrad  %xmm1,%xmm3
punpcklqdq %xmm2,%xmm5
pshuflw $0x54,%xmm0,%xmm0
movdqa %xmm11,%xmm1
psrad  %xmm0,%xmm1
punpckhqdq %xmm3,%xmm1
pshuflw $0xfe,%xmm9,%xmm0
movdqa %xmm11,%xmm2
psrad  %xmm0,%xmm2
shufps $0xcc,%xmm1,%xmm5
pshuflw $0x54,%xmm9,%xmm1
movdqa %xmm11,%xmm0
psrad  %xmm1,%xmm0
pshufd $0xee,%xmm9,%xmm1
pshuflw $0xfe,%xmm1,%xmm3
movdqa %xmm11,%xmm4
psrad  %xmm3,%xmm4
punpcklqdq %xmm2,%xmm0
pshuflw $0x54,%xmm1,%xmm1
movdqa %xmm11,%xmm2
psrad  %xmm1,%xmm2
punpckhqdq %xmm4,%xmm2
pshuflw $0xfe,%xmm8,%xmm1
movdqa %xmm11,%xmm3
psrad  %xmm1,%xmm3
shufps $0xcc,%xmm2,%xmm0
pshuflw $0x54,%xmm8,%xmm2
movdqa %xmm11,%xmm1
psrad  %xmm2,%xmm1
pshufd $0xee,%xmm8,%xmm2
pshuflw $0xfe,%xmm2,%xmm4
movdqa %xmm11,%xmm6
psrad  %xmm4,%xmm6
punpcklqdq %xmm3,%xmm1
pshuflw $0x54,%xmm2,%xmm2
movdqa %xmm11,%xmm3
psrad  %xmm2,%xmm3
punpckhqdq %xmm6,%xmm3
pshuflw $0xfe,%xmm10,%xmm2
movdqa %xmm11,%xmm4
psrad  %xmm2,%xmm4
shufps $0xcc,%xmm3,%xmm1
pshuflw $0x54,%xmm10,%xmm2
movdqa %xmm11,%xmm3
psrad  %xmm2,%xmm3
pshufd $0xee,%xmm10,%xmm2
movdqa -0x38(%rsp),%xmm10
pshuflw $0xfe,%xmm2,%xmm6
movdqa %xmm11,%xmm7
psrad  %xmm6,%xmm7
punpcklqdq %xmm4,%xmm3
pshuflw $0x54,%xmm2,%xmm2
movdqa %xmm11,%xmm4
psrad  %xmm2,%xmm4
punpckhqdq %xmm7,%xmm4
shufps $0xcc,%xmm4,%xmm3
andps  %xmm14,%xmm3
andps  %xmm14,%xmm1
packuswb %xmm1,%xmm3
andps  %xmm14,%xmm0
andps  %xmm14,%xmm5
packuswb %xmm5,%xmm0
packuswb %xmm0,%xmm3
movdqu %xmm3,0x30(%rdi,%rcx,1)
add    $0x40,%rcx
movdqa 0x89b(%rip),%xmm0
paddd  %xmm0,%xmm10
paddd  %xmm0,%xmm15
paddd  %xmm0,%xmm13
paddd  %xmm0,%xmm12
add    $0xfffffffffffffffc,%rax
jne    11e0 <denormalize+0xe0>
test   %r8,%r8
je     19de <denormalize+0x8de>
add    %rdi,%rcx
shl    $0x4,%r8
xor    %eax,%eax
movaps 0x823(%rip),%xmm8
movdqa 0x86a(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm10,%xmm4
pslld  $0x3,%xmm4
movdqa %xmm15,%xmm6
pslld  $0x3,%xmm6
movdqa %xmm13,%xmm3
movdqa %xmm12,%xmm5
pslld  $0x3,%xmm5
pshuflw $0xfe,%xmm5,%xmm0
movdqa %xmm11,%xmm7
psrad  %xmm0,%xmm7
pslld  $0x3,%xmm3
pshuflw $0x54,%xmm5,%xmm1
movdqa %xmm11,%xmm0
psrad  %xmm1,%xmm0
pshufd $0xee,%xmm5,%xmm1
pshuflw $0xfe,%xmm1,%xmm5
movdqa %xmm11,%xmm2
psrad  %xmm5,%xmm2
punpcklqdq %xmm7,%xmm0
pshuflw $0x54,%xmm1,%xmm1
movdqa %xmm11,%xmm5
psrad  %xmm1,%xmm5
punpckhqdq %xmm2,%xmm5
pshuflw $0xfe,%xmm3,%xmm1
movdqa %xmm11,%xmm2
psrad  %xmm1,%xmm2
shufps $0xcc,%xmm5,%xmm0
pshuflw $0x54,%xmm3,%xmm1
movdqa %xmm11,%xmm5
psrad  %xmm1,%xmm5
pshufd $0xee,%xmm3,%xmm1
pshuflw $0xfe,%xmm1,%xmm3
movdqa %xmm11,%xmm7
psrad  %xmm3,%xmm7
punpcklqdq %xmm2,%xmm5
pshuflw $0x54,%xmm1,%xmm1
movdqa %xmm11,%xmm2
psrad  %xmm1,%xmm2
punpckhqdq %xmm7,%xmm2
pshuflw $0xfe,%xmm6,%xmm1
movdqa %xmm11,%xmm7
psrad  %xmm1,%xmm7
shufps $0xcc,%xmm2,%xmm5
pshuflw $0x54,%xmm6,%xmm1
movdqa %xmm11,%xmm3
psrad  %xmm1,%xmm3
pshufd $0xee,%xmm6,%xmm1
pshuflw $0xfe,%xmm1,%xmm2
movdqa %xmm11,%xmm6
psrad  %xmm2,%xmm6
punpcklqdq %xmm7,%xmm3
pshuflw $0x54,%xmm1,%xmm1
movdqa %xmm11,%xmm2
psrad  %xmm1,%xmm2
punpckhqdq %xmm6,%xmm2
pshuflw $0xfe,%xmm4,%xmm1
movdqa %xmm11,%xmm6
psrad  %xmm1,%xmm6
shufps $0xcc,%xmm2,%xmm3
pshuflw $0x54,%xmm4,%xmm1
movdqa %xmm11,%xmm2
psrad  %xmm1,%xmm2
pshufd $0xee,%xmm4,%xmm1
pshuflw $0xfe,%xmm1,%xmm4
movdqa %xmm11,%xmm7
psrad  %xmm4,%xmm7
punpcklqdq %xmm6,%xmm2
pshuflw $0x54,%xmm1,%xmm1
movdqa %xmm11,%xmm4
psrad  %xmm1,%xmm4
punpckhqdq %xmm7,%xmm4
shufps $0xcc,%xmm4,%xmm2
andps  %xmm8,%xmm2
andps  %xmm8,%xmm3
packuswb %xmm3,%xmm2
andps  %xmm8,%xmm5
andps  %xmm8,%xmm0
packuswb %xmm0,%xmm5
packuswb %xmm5,%xmm2
movdqu %xmm2,(%rcx,%rax,1)
paddd  %xmm9,%xmm10
paddd  %xmm9,%xmm15
paddd  %xmm9,%xmm13
paddd  %xmm9,%xmm12
add    $0x10,%rax
cmp    %rax,%r8
jne    1850 <denormalize+0x750>
cmp    %rdx,%rsi
je     1a04 <denormalize+0x904>
lea    0x0(,%rsi,8),%ecx
nopw   0x0(%rax,%rax,1)
mov    %r9d,%eax
sar    %cl,%eax
mov    %al,(%rdi,%rsi,1)
add    $0x1,%rsi
add    $0x8,%ecx
cmp    %rsi,%rdx
jne    19f0 <denormalize+0x8f0>
ret

LLVM IR (-O0):
define void @denormalize(i8* %0, double %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i16
%10 = alloca i32
store i8* %0, i8** %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i16 0, i16* %9
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = load double, double* %6
%15 = fadd double %14, 5.000000e-01
%16 = fmul double %15, 2.550000e+02
%17 = fptosi double %16 to i16
store i16 %17, i16* %9
br label %26
18: ; preds = %4
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load double, double* %6
%23 = fmul double %22, 6.553500e+04
%24 = fptosi double %23 to i16
store i16 %24, i16* %9
br label %25
25: ; preds = %21, %18
br label %26
26: ; preds = %25, %13
store i32 0, i32* %10
br label %27
27: ; preds = %43, %26
%28 = load i32, i32* %10
%29 = load i32, i32* %7
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %46
31: ; preds = %27
%32 = load i16, i16* %9
%33 = sext i16 %32 to i32
%34 = load i32, i32* %10
%35 = mul nsw i32 %34, 8
%36 = ashr i32 %33, %35
%37 = and i32 %36, 255
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %5
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 %38, i8* %42
br label %43
43: ; preds = %31
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
store i32 %45, i32* %10
br label %27
46: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @denormalize(i8* nocapture writeonly %0, double %1, i32 %2, i32 %3) {
switch i32 %2, label %12 [
i32 1, label %5
i32 2, label %9
]
5: ; preds = %4
%6 = fadd double %1, 5.000000e-01
%7 = fmul double %6, 2.550000e+02
%8 = fptosi double %7 to i16
br label %14
9: ; preds = %4
%10 = fmul double %1, 6.553500e+04
%11 = fptosi double %10 to i16
br label %14
12: ; preds = %4
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %94
14: ; preds = %5, %9, %12
%15 = phi i16 [ 0, %12 ], [ %11, %9 ], [ %8, %5 ]
%16 = sext i16 %15 to i32
%17 = zext i32 %2 to i64
%18 = icmp ult i32 %2, 16
br i1 %18, label %83, label %19
19: ; preds = %14
%20 = and i64 %17, 4294967280
%21 = insertelement <16 x i32> poison, i32 %16, i64 0
%22 = shufflevector <16 x i32> %21, <16 x i32> poison, <16 x i32> zeroinitializer
%23 = add nsw i64 %20, -16
%24 = lshr exact i64 %23, 4
%25 = add nuw nsw i64 %24, 1
%26 = and i64 %25, 3
%27 = icmp ult i64 %23, 48
br i1 %27, label %64, label %28
28: ; preds = %19
%29 = and i64 %25, 2305843009213693948
br label %30
30: ; preds = %30, %28
%31 = phi i64 [ 0, %28 ], [ %60, %30 ]
%32 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %28 ], [ %61, %30 ]
%33 = phi i64 [ 0, %28 ], [ %62, %30 ]
%34 = shl nsw <16 x i32> %32, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%35 = ashr <16 x i32> %22, %34
%36 = trunc <16 x i32> %35 to <16 x i8>
%37 = getelementptr inbounds i8, i8* %0, i64 %31
%38 = bitcast i8* %37 to <16 x i8>*
store <16 x i8> %36, <16 x i8>* %38
%39 = or i64 %31, 16
%40 = shl <16 x i32> %32, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%41 = add <16 x i32> %40, <i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128, i32 128>
%42 = ashr <16 x i32> %22, %41
%43 = trunc <16 x i32> %42 to <16 x i8>
%44 = getelementptr inbounds i8, i8* %0, i64 %39
%45 = bitcast i8* %44 to <16 x i8>*
store <16 x i8> %43, <16 x i8>* %45
%46 = or i64 %31, 32
%47 = shl <16 x i32> %32, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%48 = add <16 x i32> %47, <i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256, i32 256>
%49 = ashr <16 x i32> %22, %48
%50 = trunc <16 x i32> %49 to <16 x i8>
%51 = getelementptr inbounds i8, i8* %0, i64 %46
%52 = bitcast i8* %51 to <16 x i8>*
store <16 x i8> %50, <16 x i8>* %52
%53 = or i64 %31, 48
%54 = shl <16 x i32> %32, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%55 = add <16 x i32> %54, <i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384, i32 384>
%56 = ashr <16 x i32> %22, %55
%57 = trunc <16 x i32> %56 to <16 x i8>
%58 = getelementptr inbounds i8, i8* %0, i64 %53
%59 = bitcast i8* %58 to <16 x i8>*
store <16 x i8> %57, <16 x i8>* %59
%60 = add nuw i64 %31, 64
%61 = add <16 x i32> %32, <i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64>
%62 = add i64 %33, 4
%63 = icmp eq i64 %62, %29
br i1 %63, label %64, label %30
64: ; preds = %30, %19
%65 = phi i64 [ 0, %19 ], [ %60, %30 ]
%66 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %19 ], [ %61, %30 ]
%67 = icmp eq i64 %26, 0
br i1 %67, label %81, label %68
68: ; preds = %64, %68
%69 = phi i64 [ %77, %68 ], [ %65, %64 ]
%70 = phi <16 x i32> [ %78, %68 ], [ %66, %64 ]
%71 = phi i64 [ %79, %68 ], [ 0, %64 ]
%72 = shl nsw <16 x i32> %70, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%73 = ashr <16 x i32> %22, %72
%74 = trunc <16 x i32> %73 to <16 x i8>
%75 = getelementptr inbounds i8, i8* %0, i64 %69
%76 = bitcast i8* %75 to <16 x i8>*
store <16 x i8> %74, <16 x i8>* %76
%77 = add nuw i64 %69, 16
%78 = add <16 x i32> %70, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%79 = add i64 %71, 1
%80 = icmp eq i64 %79, %26
br i1 %80, label %81, label %68
81: ; preds = %68, %64
%82 = icmp eq i64 %20, %17
br i1 %82, label %94, label %83
83: ; preds = %14, %81
%84 = phi i64 [ 0, %14 ], [ %20, %81 ]
br label %85
85: ; preds = %83, %85
%86 = phi i64 [ %92, %85 ], [ %84, %83 ]
%87 = trunc i64 %86 to i32
%88 = shl nsw i32 %87, 3
%89 = ashr i32 %16, %88
%90 = trunc i32 %89 to i8
%91 = getelementptr inbounds i8, i8* %0, i64 %86
store i8 %90, i8* %91
%92 = add nuw nsw i64 %86, 1
%93 = icmp eq i64 %92, %17
br i1 %93, label %94, label %85
94: ; preds = %85, %81, %12
ret void
}