// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kgetline2
static int test_kgetline2(void) {
    kstring_t s = KS_INITIALIZE;
    int mock_state = 0;

    // normal line, \n terminated, called with non-empty s
    kputs("_", &s);
    if (0 != kgetline2(&s, mock_fgets2, &mock_state) || 0 != strcmp("_ABCD", s.s) || 5 != s.l) return -1;
    s.l = 0;
    // empty line, \n terminated
    if (0 != kgetline2(&s, mock_fgets2, &mock_state) || 0 != strcmp("", s.s) || 0 != s.l) return -1;
    s.l = 0;
    // normal line, \r\n terminated
    if (0 != kgetline2(&s, mock_fgets2, &mock_state) || 0 != strcmp("ABCD", s.s) || 4 != s.l) return -1;
    s.l = 0;
    // empty line, \r\n terminated
    if (0 != kgetline2(&s, mock_fgets2, &mock_state) || 0 != strcmp("", s.s) || 0 != s.l) return -1;
    s.l = 0;
    // line terminated by EOF
    if (0 != kgetline2(&s, mock_fgets2, &mock_state) || 0 != strcmp("ABCD", s.s) || 4 != s.l) return -1;
    s.l = 0;
    // EOF
    if (EOF != kgetline2(&s, mock_fgets2, &mock_state) || 0 != s.l) return -1;

    ks_free(&s);
    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x10b0
movl $0x0, -0x24(%rbp)
leaq 0x4225(%rip), %rdi      # 0x658b
leaq -0x20(%rbp), %rsi
callq 0x34d0
leaq -0x20(%rbp), %rdi
leaq 0x1386(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x23ae
movq -0x10(%rbp), %rsi
leaq 0x41f7(%rip), %rdi      # 0x658d
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x23ae
movl $0x5, %eax
cmpq -0x20(%rbp), %rax
je 0x23ba
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1333(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x23fe
movq -0x10(%rbp), %rsi
leaq 0x41ac(%rip), %rdi      # 0x6595
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x23fe
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x240a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x12e3(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2451
movq -0x10(%rbp), %rsi
leaq 0x4155(%rip), %rdi      # 0x658e
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2451
movl $0x4, %eax
cmpq -0x20(%rbp), %rax
je 0x245d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1290(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x24a1
movq -0x10(%rbp), %rsi
leaq 0x4109(%rip), %rdi      # 0x6595
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x24a1
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x24ad
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1240(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x24f4
movq -0x10(%rbp), %rsi
leaq 0x40b2(%rip), %rdi      # 0x658e
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x24f4
movl $0x4, %eax
cmpq -0x20(%rbp), %rax
je 0x24fd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x11f0(%rip), %rsi      # 0x3700
leaq -0x24(%rbp), %rdx
callq 0x4b70
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x252c
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x2535
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2545
leaq -0x20(%rbp), %rdi
callq 0x35f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop