#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ xfwrite(char *, size_t, int /*<<< orphan*/ *);
void write_int(uint64_t value, size_t len, FILE *to) {
  char buf[len];
  int i;
  for (i = 0; i < len; i++)
    buf[i] = ((value >> (8 * i)) & 0xff);
  xfwrite(buf, len, to);
}


x86 assembly (clang, -O0):
<write_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118d <write_int+0x7d>
mov    -0x38(%rbp),%rax
mov    -0x4(%rbp),%edx
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
mov    %cl,%dl
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1151 <write_int+0x41>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <xfwrite@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_int>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rsp,%r8
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r8
mov    %r8,%rsp
test   %rsi,%rsi
je     19f4 <write_int+0x8e4>
cmp    $0x10,%rsi
jae    1140 <write_int+0x30>
xor    %ebx,%ebx
jmp    19d4 <write_int+0x8c4>
mov    %rsi,%rbx
and    $0xfffffffffffffff0,%rbx
movd   %edi,%xmm0
pshufd $0x0,%xmm0,%xmm11
lea    -0x10(%rbx),%rcx
mov    %rcx,%r10
shr    $0x4,%r10
add    $0x1,%r10
mov    %r10d,%r9d
and    $0x3,%r9d
cmp    $0x30,%rcx
jae    1199 <write_int+0x89>
movdqa 0xe8a(%rip),%xmm12
movdqa 0xe91(%rip),%xmm13
movdqa 0xe98(%rip),%xmm15
movdqa 0xe9f(%rip),%xmm10
xor    %r11d,%r11d
jmp    1810 <write_int+0x700>
and    $0xfffffffffffffffc,%r10
movdqa 0xe5a(%rip),%xmm12
movdqa 0xe61(%rip),%xmm13
movdqa 0xe68(%rip),%xmm15
movdqa 0xe6f(%rip),%xmm10
xor    %r11d,%r11d
movaps 0xe74(%rip),%xmm14
nopl   0x0(%rax)
movdqa %xmm10,-0x20(%rbp)
movdqa %xmm15,-0x30(%rbp)
movdqa %xmm12,-0x40(%rbp)
movdqa -0x20(%rbp),%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
movdqa %xmm7,(%r8,%r11,1)
movdqa %xmm10,%xmm12
movdqa 0xcd6(%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 -0x30(%rbp),%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
movdqa %xmm6,0x10(%r8,%r11,1)
movdqa %xmm10,%xmm12
movdqa 0xb5c(%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 -0x40(%rbp),%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
movdqa %xmm4,0x20(%r8,%r11,1)
movdqa 0x9f3(%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 -0x20(%rbp),%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
movdqa %xmm3,0x30(%r8,%r11,1)
add    $0x40,%r11
movdqa 0x88e(%rip),%xmm0
paddd  %xmm0,%xmm10
paddd  %xmm0,%xmm15
paddd  %xmm0,%xmm13
paddd  %xmm0,%xmm12
add    $0xfffffffffffffffc,%r10
jne    11d0 <write_int+0xc0>
test   %r9,%r9
je     19cf <write_int+0x8bf>
add    %r8,%r11
shl    $0x4,%r9
xor    %ecx,%ecx
movaps 0x816(%rip),%xmm8
movdqa 0x85d(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
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
movdqa %xmm2,(%r11,%rcx,1)
paddd  %xmm9,%xmm10
paddd  %xmm9,%xmm15
paddd  %xmm9,%xmm13
paddd  %xmm9,%xmm12
add    $0x10,%rcx
cmp    %rcx,%r9
jne    1840 <write_int+0x730>
cmp    %rsi,%rbx
je     19f4 <write_int+0x8e4>
lea    0x0(,%rbx,8),%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
sar    %cl,%eax
mov    %al,(%r8,%rbx,1)
add    $0x1,%rbx
add    $0x8,%ecx
cmp    %rbx,%rsi
jne    19e0 <write_int+0x8d0>
mov    %r8,%rdi
call   1030 <xfwrite@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @write_int(i32 %0, i64 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%10 = load i64, i64* %5
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i8, i64 %10
store i64 %10, i64* %8
store i32 0, i32* %9
br label %13
13: ; preds = %28, %3
%14 = load i32, i32* %9
%15 = sext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %13
%19 = load i32, i32* %4
%20 = load i32, i32* %9
%21 = mul nsw i32 8, %20
%22 = ashr i32 %19, %21
%23 = and i32 %22, 255
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %12, i64 %26
store i8 %24, i8* %27
br label %28
28: ; preds = %18
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %13
31: ; preds = %13
%32 = load i64, i64* %5
%33 = load i32*, i32** %6
%34 = call i32 @xfwrite(i8* %12, i64 %32, i32* %33)
%35 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @write_int(i32 %0, i64 %1, i32* %2) {
%4 = alloca i8, i64 %1
%5 = icmp eq i64 %1, 0
br i1 %5, label %83, label %6
6: ; preds = %3
%7 = icmp ult i64 %1, 16
br i1 %7, label %72, label %8
8: ; preds = %6
%9 = and i64 %1, -16
%10 = insertelement <16 x i32> poison, i32 %0, i64 0
%11 = shufflevector <16 x i32> %10, <16 x i32> poison, <16 x i32> zeroinitializer
%12 = add i64 %9, -16
%13 = lshr exact i64 %12, 4
%14 = add nuw nsw i64 %13, 1
%15 = and i64 %14, 3
%16 = icmp ult i64 %12, 48
br i1 %16, label %53, label %17
17: ; preds = %8
%18 = and i64 %14, 2305843009213693948
br label %19
19: ; preds = %19, %17
%20 = phi i64 [ 0, %17 ], [ %49, %19 ]
%21 = 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>, %17 ], [ %50, %19 ]
%22 = phi i64 [ 0, %17 ], [ %51, %19 ]
%23 = shl nsw <16 x i32> %21, <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>
%24 = ashr <16 x i32> %11, %23
%25 = trunc <16 x i32> %24 to <16 x i8>
%26 = getelementptr inbounds i8, i8* %4, i64 %20
%27 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> %25, <16 x i8>* %27
%28 = or i64 %20, 16
%29 = shl <16 x i32> %21, <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>
%30 = add <16 x i32> %29, <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>
%31 = ashr <16 x i32> %11, %30
%32 = trunc <16 x i32> %31 to <16 x i8>
%33 = getelementptr inbounds i8, i8* %4, i64 %28
%34 = bitcast i8* %33 to <16 x i8>*
store <16 x i8> %32, <16 x i8>* %34
%35 = or i64 %20, 32
%36 = shl <16 x i32> %21, <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>
%37 = add <16 x i32> %36, <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>
%38 = ashr <16 x i32> %11, %37
%39 = trunc <16 x i32> %38 to <16 x i8>
%40 = getelementptr inbounds i8, i8* %4, i64 %35
%41 = bitcast i8* %40 to <16 x i8>*
store <16 x i8> %39, <16 x i8>* %41
%42 = or i64 %20, 48
%43 = shl <16 x i32> %21, <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>
%44 = add <16 x i32> %43, <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>
%45 = ashr <16 x i32> %11, %44
%46 = trunc <16 x i32> %45 to <16 x i8>
%47 = getelementptr inbounds i8, i8* %4, i64 %42
%48 = bitcast i8* %47 to <16 x i8>*
store <16 x i8> %46, <16 x i8>* %48
%49 = add nuw i64 %20, 64
%50 = add <16 x i32> %21, <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>
%51 = add i64 %22, 4
%52 = icmp eq i64 %51, %18
br i1 %52, label %53, label %19
53: ; preds = %19, %8
%54 = phi i64 [ 0, %8 ], [ %49, %19 ]
%55 = 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>, %8 ], [ %50, %19 ]
%56 = icmp eq i64 %15, 0
br i1 %56, label %70, label %57
57: ; preds = %53, %57
%58 = phi i64 [ %66, %57 ], [ %54, %53 ]
%59 = phi <16 x i32> [ %67, %57 ], [ %55, %53 ]
%60 = phi i64 [ %68, %57 ], [ 0, %53 ]
%61 = shl nsw <16 x i32> %59, <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>
%62 = ashr <16 x i32> %11, %61
%63 = trunc <16 x i32> %62 to <16 x i8>
%64 = getelementptr inbounds i8, i8* %4, i64 %58
%65 = bitcast i8* %64 to <16 x i8>*
store <16 x i8> %63, <16 x i8>* %65
%66 = add nuw i64 %58, 16
%67 = add <16 x i32> %59, <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>
%68 = add i64 %60, 1
%69 = icmp eq i64 %68, %15
br i1 %69, label %70, label %57
70: ; preds = %57, %53
%71 = icmp eq i64 %9, %1
br i1 %71, label %83, label %72
72: ; preds = %6, %70
%73 = phi i64 [ 0, %6 ], [ %9, %70 ]
br label %74
74: ; preds = %72, %74
%75 = phi i64 [ %81, %74 ], [ %73, %72 ]
%76 = trunc i64 %75 to i32
%77 = shl nsw i32 %76, 3
%78 = ashr i32 %0, %77
%79 = trunc i32 %78 to i8
%80 = getelementptr inbounds i8, i8* %4, i64 %75
store i8 %79, i8* %80
%81 = add nuw nsw i64 %75, 1
%82 = icmp eq i64 %81, %1
br i1 %82, label %83, label %74
83: ; preds = %74, %70, %3
%84 = call i32 @xfwrite(i8* %4, i64 %1, i32* %2)
ret void
}