// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kputll
static int test_kputll(long long start, long long end) {
    kstring_t str = { 0, 0, NULL };
    unsigned long long val;

    str.s = malloc(2);
    if (!str.s) {
        perror("malloc");
        return -1;
    }
    str.m = 2;

    for (val = 1; val < INT64_MAX-5; val *= 10) {
        if (test_kputll_from_to(&str, val >= 5 ? val - 5 : val, val) < 0) {
            free(ks_release(&str));
            return -1;
        }
    }

    for (val = 1; val < INT64_MAX-5; val *= 10) {
        long long valm = -val;
        if (test_kputll_from_to(&str, valm >= 5 ? valm - 5 : valm, valm) < 0) {
            free(ks_release(&str));
            return -1;
        }
    }

    if (test_kputll_from_to(&str, INT64_MAX - 5, INT64_MAX) < 0) {
        free(ks_release(&str));
        return -1;
    }

    if (test_kputll_from_to(&str, INT64_MIN, INT64_MIN + 5) < 0) {
        free(ks_release(&str));
        return -1;
    }

    str.m = 1; // Force a resize
    int64_t start2 = (int64_t)start; // no larger on our platforms
    int64_t end2   = (int64_t)end;
    clamp(&start2, INT64_MIN, INT64_MAX);
    clamp(&end2,   INT64_MIN, INT64_MAX);

    if (test_kputll_from_to(&str, start, end) < 0) {
        free(ks_release(&str));
        return -1;
    }

    free(ks_release(&str));

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x10b0
movl $0x2, %edi
callq 0x1130
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1f0d
leaq 0x4571(%rip), %rdi      # 0x646d
callq 0x10f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
movq $0x2, -0x28(%rbp)
movq $0x1, -0x38(%rbp)
movabsq $0x7ffffffffffffffa, %rax # imm = 0x7FFFFFFFFFFFFFFA
cmpq %rax, -0x38(%rbp)
jae 0x1f8a
cmpq $0x5, -0x38(%rbp)
jb 0x1f42
movq -0x38(%rbp), %rax
subq $0x5, %rax
movq %rax, -0x58(%rbp)
jmp 0x1f4a
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x31f0
cmpl $0x0, %eax
jge 0x1f7d
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
jmp 0x1f7f
imulq $0xa, -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x1f1d
movq $0x1, -0x38(%rbp)
movabsq $0x7ffffffffffffffa, %rax # imm = 0x7FFFFFFFFFFFFFFA
cmpq %rax, -0x38(%rbp)
jae 0x2009
xorl %eax, %eax
subq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x5, -0x40(%rbp)
jl 0x1fc1
movq -0x40(%rbp), %rax
subq $0x5, %rax
movq %rax, -0x60(%rbp)
jmp 0x1fc9
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x31f0
cmpl $0x0, %eax
jge 0x1ffc
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
jmp 0x1ffe
imulq $0xa, -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x1f92
leaq -0x30(%rbp), %rdi
movabsq $0x7ffffffffffffffa, %rsi # imm = 0x7FFFFFFFFFFFFFFA
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x31f0
cmpl $0x0, %eax
jge 0x2048
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
leaq -0x30(%rbp), %rdi
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movabsq $-0x7ffffffffffffffb, %rdx # imm = 0x8000000000000005
callq 0x31f0
cmpl $0x0, %eax
jge 0x2087
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
movq $0x1, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x2da0
leaq -0x50(%rbp), %rdi
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x2da0
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x31f0
cmpl $0x0, %eax
jge 0x2109
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2121
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)