// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/../htscodecs/htscodecs/varint.h
// Function: var_put_u32
static inline
int var_put_u32(uint8_t *cp, const uint8_t *endp, uint32_t i) {
    if (endp && (endp-cp) < 5)
        return var_put_u32_safe(cp, endp, i);

    if (i < (1<<7)) {
        *cp = i;
        return 1;
    } else if (i < (1<<14)) {
        *cp++ = ((i>> 7) & 0x7f) | 128;
        *cp++ =   i      & 0x7f;
        return 2;
    } else if (i < (1<<21)) {
        *cp++ = ((i>>14) & 0x7f) | 128;
        *cp++ = ((i>> 7) & 0x7f) | 128;
        *cp++ =   i      & 0x7f;
        return 3;
    } else if (i < (1<<28)) {
        *cp++ = ((i>>21) & 0x7f) | 128;
        *cp++ = ((i>>14) & 0x7f) | 128;
        *cp++ = ((i>> 7) & 0x7f) | 128;
        *cp++ =   i      & 0x7f;
        return 4;
    } else {
        *cp++ = ((i>>28) & 0x7f) | 128;
        *cp++ = ((i>>21) & 0x7f) | 128;
        *cp++ = ((i>>14) & 0x7f) | 128;
        *cp++ = ((i>> 7) & 0x7f) | 128;
        *cp++ =   i      & 0x7f;
    }

    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7de83
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x5, %rax
jge 0x7de83
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x7e0b0
movl %eax, -0x4(%rbp)
jmp 0x7e0a1
cmpl $0x80, -0x1c(%rbp)
jae 0x7dea3
movl -0x1c(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x7e0a1
cmpl $0x4000, -0x1c(%rbp)    # imm = 0x4000
jae 0x7def2
movl -0x1c(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
andl $0x7f, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl $0x2, -0x4(%rbp)
jmp 0x7e0a1
cmpl $0x200000, -0x1c(%rbp)  # imm = 0x200000
jae 0x7df62
movl -0x1c(%rbp), %eax
shrl $0xe, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
andl $0x7f, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl $0x3, -0x4(%rbp)
jmp 0x7e0a1
cmpl $0x10000000, -0x1c(%rbp) # imm = 0x10000000
jae 0x7dff7
movl -0x1c(%rbp), %eax
shrl $0x15, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0xe, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
andl $0x7f, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl $0x4, -0x4(%rbp)
jmp 0x7e0a1
movl -0x1c(%rbp), %eax
shrl $0x1c, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0x15, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0xe, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
shrl $0x7, %eax
andl $0x7f, %eax
orl $0x80, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
andl $0x7f, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
jmp 0x7e096
jmp 0x7e098
jmp 0x7e09a
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)