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

    // normal line, \n terminated, called with non-empty s
    kputs("_", &s);
    if (0 != kgetline(&s, mock_fgets, &mock_state) || 0 != strcmp("_ABCD", s.s) || 5 != s.l) return -1;
    s.l = 0;
    // empty line, \n terminated
    if (0 != kgetline(&s, mock_fgets, &mock_state) || 0 != strcmp("", s.s) || 0 != s.l) return -1;
    s.l = 0;
    // normal line, \r\n terminated
    if (0 != kgetline(&s, mock_fgets, &mock_state) || 0 != strcmp("ABCD", s.s) || 4 != s.l) return -1;
    s.l = 0;
    // empty line, \r\n terminated
    if (0 != kgetline(&s, mock_fgets, &mock_state) || 0 != strcmp("", s.s) || 0 != s.l) return -1;
    s.l = 0;
    // line terminated by EOF
    if (0 != kgetline(&s, mock_fgets, &mock_state) || 0 != strcmp("ABCD", s.s) || 4 != s.l) return -1;
    s.l = 0;
    // EOF
    if (EOF != kgetline(&s, mock_fgets, &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 0x4435(%rip), %rdi      # 0x658b
leaq -0x20(%rbp), %rsi
callq 0x34d0
leaq -0x20(%rbp), %rdi
leaq 0x13c6(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x219e
movq -0x10(%rbp), %rsi
leaq 0x4407(%rip), %rdi      # 0x658d
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x219e
movl $0x5, %eax
cmpq -0x20(%rbp), %rax
je 0x21aa
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1373(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x21ee
movq -0x10(%rbp), %rsi
leaq 0x43bc(%rip), %rdi      # 0x6595
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x21ee
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x21fa
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1323(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2241
movq -0x10(%rbp), %rsi
leaq 0x4365(%rip), %rdi      # 0x658e
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2241
movl $0x4, %eax
cmpq -0x20(%rbp), %rax
je 0x224d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x12d0(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2291
movq -0x10(%rbp), %rsi
leaq 0x4319(%rip), %rdi      # 0x6595
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2291
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x229d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1280(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x22e4
movq -0x10(%rbp), %rsi
leaq 0x42c2(%rip), %rdi      # 0x658e
callq 0x1140
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x22e4
movl $0x4, %eax
cmpq -0x20(%rbp), %rax
je 0x22ed
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
movq $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1230(%rip), %rsi      # 0x3530
leaq -0x24(%rbp), %rdx
callq 0x49c0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x231c
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x2325
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2335
leaq -0x20(%rbp), %rdi
callq 0x35f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop