// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/subref_t.c
// Function: main
int main(void)
{
    plan_tests(9);

    MEMREF  act, x = strref("hello, world");
#   define S(s) ((s) ? (s) : "(null)")
#   define TRY(p, l, exp) \
        if (!ok(!refcmp(act = subref(x,p,l), strref(exp)), "(%d, %d): %s", p, l, S(exp))) \
            fprintf(stderr, "act[%"FSIZE"d]: %.*s\n", act.len, (int)act.len, S(act.ptr))

    TRY(  0,  5, "hello");
    TRY(  2,  3, "llo");
    TRY( -5,  2, "wo");
    TRY( -5, 99, "world");
    TRY(-12,  2, "he");
    TRY(  0, -1, x.ptr);    // (len) is unsigned, so (-1) is just a very big positive number.
    TRY(  0,  0, NULL);
    TRY(  1,  0, NULL);
    TRY(-13,  2, NULL);

    return exit_status();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x9
popq %rdi
callq 0x54a3
leaq 0x2bae(%rip), %rdi      # 0x6004
callq 0x3bb2
movq %rax, %r15
movq %rdx, %rbx
movq %rax, %r14
pushq $0x5
popq %rcx
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x48ac
movq %rax, %r13
movq %rdx, %r12
leaq 0x2b90(%rip), %rbp      # 0x6011
movq %rbp, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4753
subq $0x30, %rsp
testl %eax, %eax
je 0x34e0
movq %rbp, 0x28(%rsp)
leaq 0x2b79(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
leaq 0x2b62(%rip), %rax      # 0x601c
movq %rax, (%rsp)
movl $0x5, 0x20(%rsp)
andl $0x0, 0x18(%rsp)
movl $0x22, 0x8(%rsp)
leaq 0x2b3d(%rip), %r9       # 0x6017
xorl %edi, %edi
xorl %esi, %esi
jmp 0x351d
movq %rbp, 0x28(%rsp)
leaq 0x2b3b(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
leaq 0x2b24(%rip), %rax      # 0x601c
andl $0x0, 0x18(%rsp)
movq %rax, (%rsp)
movl $0x5, 0x20(%rsp)
movl $0x22, 0x8(%rsp)
leaq 0x2aff(%rip), %r9       # 0x6017
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3a0b
pushq $0x2
popq %rdx
pushq $0x3
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x48ac
movq %rax, %r13
movq %rdx, %r12
leaq 0x2abe(%rip), %rbp      # 0x6013
movq %rbp, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4753
leaq 0x2ab2(%rip), %r10      # 0x6027
leaq 0x2aa0(%rip), %r11      # 0x601c
leaq 0x2a94(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x358d
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3592
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %rbp
pushq $0x3
pushq $0x2
pushq %r10
pushq $0x23
pushq %r11
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3a3c
pushq $-0x5
popq %rdx
pushq $0x2
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x48ac
movq %rax, %r13
movq %rdx, %r12
leaq 0x2a76(%rip), %rbp      # 0x604b
movq %rbp, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4753
leaq 0x2a32(%rip), %r10      # 0x6027
leaq 0x2a20(%rip), %r11      # 0x601c
leaq 0x2a14(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x360d
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3612
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %rbp
pushq $0x2
pushq $-0x5
pushq %r10
pushq $0x24
pushq %r11
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3a6d
pushq $-0x5
popq %rdx
pushq $0x63
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x48ac
movq %rax, %r13
movq %rdx, %r12
leaq 0x29b6(%rip), %rbp      # 0x600b
movq %rbp, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4753
leaq 0x29b2(%rip), %r10      # 0x6027
leaq 0x29a0(%rip), %r11      # 0x601c
leaq 0x2994(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x368d
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3692
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %rbp
pushq $0x63
pushq $-0x5
pushq %r10
pushq $0x25
pushq %r11
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3a9e
pushq $-0xc
popq %rdx
pushq $0x2
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x48ac
movq %rax, %r13
movq %rdx, %r12
leaq 0x2979(%rip), %rbp      # 0x604e
movq %rbp, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x4753
leaq 0x2932(%rip), %r10      # 0x6027
leaq 0x2920(%rip), %r11      # 0x601c
leaq 0x2914(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x370d
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3712
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %rbp
pushq $0x2
pushq $-0xc
pushq %r10
pushq $0x26
pushq %r11
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3acf
pushq $-0x1
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x48ac
movq %rax, %r13
movq %rdx, %rbp
movq %r14, %rdi
callq 0x3bb2
movq %rdx, %rcx
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x4753
testq %r15, %r15
leaq 0x28c4(%rip), %r12      # 0x6034
cmoveq %r12, %r15
subq $0x30, %rsp
testl %eax, %eax
je 0x37b7
movq %r15, 0x28(%rsp)
leaq 0x289f(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
leaq 0x2888(%rip), %rax      # 0x601c
movq %rax, (%rsp)
orl $-0x1, 0x20(%rsp)
andl $0x0, 0x18(%rsp)
movl $0x27, 0x8(%rsp)
leaq 0x2866(%rip), %r9       # 0x6017
xorl %edi, %edi
xorl %esi, %esi
jmp 0x37f1
movq %r15, 0x28(%rsp)
leaq 0x2864(%rip), %rax      # 0x6027
orl $-0x1, 0x20(%rsp)
movq %rax, 0x10(%rsp)
andl $0x0, 0x18(%rsp)
leaq 0x2843(%rip), %rax      # 0x601c
movq %rax, (%rsp)
movl $0x27, 0x8(%rsp)
leaq 0x282b(%rip), %r9       # 0x6017
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3b00
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x48ac
movq %rax, %r15
movq %rdx, %r13
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4753
subq $0x30, %rsp
testl %eax, %eax
je 0x3872
movq %r12, 0x28(%rsp)
leaq 0x27e4(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
leaq 0x27cd(%rip), %rax      # 0x601c
movq %rax, (%rsp)
andl $0x0, 0x20(%rsp)
andl $0x0, 0x18(%rsp)
movl $0x28, 0x8(%rsp)
leaq 0x27ab(%rip), %r9       # 0x6017
xorl %edi, %edi
xorl %esi, %esi
jmp 0x38ac
movq %r12, 0x28(%rsp)
leaq 0x27a9(%rip), %rax      # 0x6027
andl $0x0, 0x20(%rsp)
movq %rax, 0x10(%rsp)
andl $0x0, 0x18(%rsp)
leaq 0x2788(%rip), %rax      # 0x601c
movq %rax, (%rsp)
movl $0x28, 0x8(%rsp)
leaq 0x2770(%rip), %r9       # 0x6017
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3b2c
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x48ac
movq %rax, %r15
movq %rdx, %r13
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4753
subq $0x30, %rsp
testl %eax, %eax
je 0x3931
movq %r12, 0x28(%rsp)
leaq 0x2728(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
andl $0x0, 0x20(%rsp)
leaq 0x270c(%rip), %rax      # 0x601c
movq %rax, (%rsp)
movl $0x1, 0x18(%rsp)
movl $0x29, 0x8(%rsp)
leaq 0x26ec(%rip), %r9       # 0x6017
xorl %edi, %edi
xorl %esi, %esi
jmp 0x396e
movq %r12, 0x28(%rsp)
leaq 0x26ea(%rip), %rax      # 0x6027
movq %rax, 0x10(%rsp)
leaq 0x26d3(%rip), %rax      # 0x601c
andl $0x0, 0x20(%rsp)
movq %rax, (%rsp)
movl $0x1, 0x18(%rsp)
movl $0x29, 0x8(%rsp)
leaq 0x26ae(%rip), %r9       # 0x6017
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3b59
pushq $-0xd
popq %rdx
pushq $0x2
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x48ac
movq %rax, %r14
movq %rdx, %rbx
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4753
leaq 0x2672(%rip), %r10      # 0x6027
leaq 0x2660(%rip), %r11      # 0x601c
leaq 0x2654(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x39cd
xorl %edi, %edi
xorl %esi, %esi
jmp 0x39d2
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r12
pushq $0x2
pushq $-0xd
pushq %r10
pushq $0x2a
pushq %r11
callq 0x4b94
addq $0x30, %rsp
testl %eax, %eax
je 0x3b86
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5741
movq 0x55ce(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
leaq 0x2615(%rip), %r8       # 0x6034
cmovneq %r13, %r8
leaq 0x2611(%rip), %rsi      # 0x603b
movq %r12, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3537
movq 0x559d(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
leaq 0x25e4(%rip), %r8       # 0x6034
cmovneq %r13, %r8
leaq 0x25e0(%rip), %rsi      # 0x603b
movq %r12, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x35b7
movq 0x556c(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
leaq 0x25b3(%rip), %r8       # 0x6034
cmovneq %r13, %r8
leaq 0x25af(%rip), %rsi      # 0x603b
movq %r12, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3637
movq 0x553b(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
leaq 0x2582(%rip), %r8       # 0x6034
cmovneq %r13, %r8
leaq 0x257e(%rip), %rsi      # 0x603b
movq %r12, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x36b7
movq 0x550a(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
leaq 0x2551(%rip), %r8       # 0x6034
cmovneq %r13, %r8
leaq 0x254d(%rip), %rsi      # 0x603b
movq %r12, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3737
movq 0x54d9(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r13, %r13
cmoveq %r12, %r13
leaq 0x2523(%rip), %rsi      # 0x603b
movq %rbp, %rdx
movl %ebp, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x3270
jmp 0x380b
movq 0x54ad(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r15, %r15
cmoveq %r12, %r15
leaq 0x24f7(%rip), %rsi      # 0x603b
movq %r13, %rdx
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x3270
jmp 0x38c6
movq 0x5480(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r15, %r15
cmoveq %r12, %r15
leaq 0x24ca(%rip), %rsi      # 0x603b
movq %r13, %rdx
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x3270
jmp 0x3988
movq 0x5453(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
cmovneq %r14, %r12
leaq 0x249d(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x3270
jmp 0x39f8