// File: lvandeve[P]lodepng/lodepng.cpp
// Function: ensureBits32(LodePNGBitReader*, unsigned long)
static LODEPNG_INLINE void ensureBits32(LodePNGBitReader* reader, size_t nbits) {
  size_t start = reader->bp >> 3u;
  size_t size = reader->size;
  if(start + 4u < size) {
    reader->buffer = (unsigned)reader->data[start + 0] | ((unsigned)reader->data[start + 1] << 8u) |
                     ((unsigned)reader->data[start + 2] << 16u) | ((unsigned)reader->data[start + 3] << 24u);
    reader->buffer >>= (reader->bp & 7u);
    reader->buffer |= (((unsigned)reader->data[start + 4] << 24u) << (8u - (reader->bp & 7u)));
  } else {
    reader->buffer = 0;
    if(start + 0u < size) reader->buffer |= reader->data[start + 0];
    if(start + 1u < size) reader->buffer |= ((unsigned)reader->data[start + 1] << 8u);
    if(start + 2u < size) reader->buffer |= ((unsigned)reader->data[start + 2] << 16u);
    if(start + 3u < size) reader->buffer |= ((unsigned)reader->data[start + 3] << 24u);
    reader->buffer >>= (reader->bp & 7u);
  }
  (void)nbits;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x3, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq $0x4, %rax
cmpq -0x20(%rbp), %rax
jae 0x13423
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdx
movzbl 0x1(%rax,%rdx), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdx
movzbl 0x2(%rax,%rdx), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdx
movzbl 0x3(%rax,%rdx), %eax
shll $0x18, %eax
orl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
andq $0x7, %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edx
shrl %cl, %edx
movl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl 0x4(%rax,%rcx), %eax
shll $0x18, %eax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rdx
andq $0x7, %rdx
movl $0x8, %ecx
subq %rdx, %rcx
shll %cl, %eax
movl %eax, %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
jmp 0x134f0
movq -0x8(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
addq $0x0, %rax
cmpq -0x20(%rbp), %rax
jae 0x13455
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
cmpq -0x20(%rbp), %rax
jae 0x13480
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl 0x1(%rax,%rcx), %ecx
shll $0x8, %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
addq $0x2, %rax
cmpq -0x20(%rbp), %rax
jae 0x134ab
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl 0x2(%rax,%rcx), %ecx
shll $0x10, %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
addq $0x3, %rax
cmpq -0x20(%rbp), %rax
jae 0x134d6
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl 0x3(%rax,%rcx), %ecx
shll $0x18, %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
andq $0x7, %rcx
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edx
shrl %cl, %edx
movl %edx, %ecx
movl %ecx, 0x20(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)