// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x9, %edi
callq 0x549a
leaq 0x2b1f(%rip), %rdi      # 0x6004
movl $0xc, %esi
xorl %edx, %edx
movl $0x5, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
leaq 0x2b0e(%rip), %r15      # 0x6011
movl $0x5, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x2b0a(%rip), %r10      # 0x6027
leaq 0x2af8(%rip), %r11      # 0x601c
leaq 0x2aec(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x3535
xorl %edi, %edi
xorl %esi, %esi
jmp 0x353c
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $0x5
pushq $0x0
pushq %r10
pushq $0x22
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3991
leaq 0x2a9b(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0x2, %edx
movl $0x3, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
leaq 0x2a89(%rip), %r15      # 0x6013
movl $0x3, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x2a83(%rip), %r10      # 0x6027
leaq 0x2a71(%rip), %r11      # 0x601c
leaq 0x2a65(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x35bc
xorl %edi, %edi
xorl %esi, %esi
jmp 0x35c3
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $0x3
pushq $0x2
pushq %r10
pushq $0x23
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x39c1
leaq 0x2a14(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0xfffffffb, %edx       # imm = 0xFFFFFFFB
movl $0x2, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
leaq 0x2a3a(%rip), %r15      # 0x604b
movl $0x2, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x29fc(%rip), %r10      # 0x6027
leaq 0x29ea(%rip), %r11      # 0x601c
leaq 0x29de(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x3643
xorl %edi, %edi
xorl %esi, %esi
jmp 0x364a
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $0x2
pushq $-0x5
pushq %r10
pushq $0x24
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x39f1
leaq 0x298d(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0xfffffffb, %edx       # imm = 0xFFFFFFFB
movl $0x63, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
leaq 0x2973(%rip), %r15      # 0x600b
movl $0x5, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x2975(%rip), %r10      # 0x6027
leaq 0x2963(%rip), %r11      # 0x601c
leaq 0x2957(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x36ca
xorl %edi, %edi
xorl %esi, %esi
jmp 0x36d1
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $0x63
pushq $-0x5
pushq %r10
pushq $0x25
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3a21
leaq 0x2906(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0xfffffff4, %edx       # imm = 0xFFFFFFF4
movl $0x2, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
leaq 0x292f(%rip), %r15      # 0x604e
movl $0x2, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x28ee(%rip), %r10      # 0x6027
leaq 0x28dc(%rip), %r11      # 0x601c
leaq 0x28d0(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x3751
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3758
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $0x2
pushq $-0xc
pushq %r10
pushq $0x26
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3a51
leaq 0x287f(%rip), %r15      # 0x6004
movl $0xc, %esi
movq %r15, %rdi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
movl $0xc, %ecx
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x473f
leaq 0x286e(%rip), %r10      # 0x6027
leaq 0x285c(%rip), %r11      # 0x601c
leaq 0x2850(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x37d1
xorl %edi, %edi
xorl %esi, %esi
jmp 0x37d8
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r15
pushq $-0x1
pushq $0x0
pushq %r10
pushq $0x27
pushq %r11
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3a81
leaq 0x27ff(%rip), %rdi      # 0x6004
xorl %r15d, %r15d
movl $0xc, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x473f
leaq 0x2802(%rip), %r10      # 0x6034
leaq 0x27ee(%rip), %r11      # 0x6027
leaq 0x27dc(%rip), %r12      # 0x601c
leaq 0x27d0(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x3851
xorl %edi, %edi
xorl %esi, %esi
jmp 0x3858
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r15
pushq %r11
pushq $0x28
pushq %r12
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3ab1
leaq 0x277f(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x473f
leaq 0x2782(%rip), %r10      # 0x6034
leaq 0x276e(%rip), %r11      # 0x6027
leaq 0x275c(%rip), %r15      # 0x601c
leaq 0x2750(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x38d1
xorl %edi, %edi
xorl %esi, %esi
jmp 0x38d8
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r10
pushq $0x0
pushq $0x1
pushq %r11
pushq $0x29
pushq %r15
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3ae1
leaq 0x26ff(%rip), %rdi      # 0x6004
movl $0xc, %esi
movl $0xfffffff3, %edx       # imm = 0xFFFFFFF3
movl $0x2, %ecx
callq 0x48a7
movq %rax, %r14
movq %rdx, %rbx
movq %rax, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x473f
leaq 0x26ff(%rip), %r10      # 0x6034
leaq 0x26eb(%rip), %r11      # 0x6027
leaq 0x26d9(%rip), %r15      # 0x601c
leaq 0x26cd(%rip), %r9       # 0x6017
testl %eax, %eax
je 0x3954
xorl %edi, %edi
xorl %esi, %esi
jmp 0x395b
movl $0x1, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r10
pushq $0x2
pushq $-0xd
pushq %r11
pushq $0x2a
pushq %r15
callq 0x4bc4
addq $0x30, %rsp
testl %eax, %eax
je 0x3b11
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x573e
movq 0x5648(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x268f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x268b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3562
movq 0x5618(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x265f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x265b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x35e9
movq 0x55e8(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x262f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x262b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3670
movq 0x55b8(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x25ff(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x25fb(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x36f7
movq 0x5588(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x25cf(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x25cb(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x377e
movq 0x5558(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x259f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x259b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x37fe
movq 0x5528(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x256f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x256b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x387e
movq 0x54f8(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x253f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x253b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x38fe
movq 0x54c8(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
testq %r14, %r14
leaq 0x250f(%rip), %r8       # 0x6034
cmovneq %r14, %r8
leaq 0x250b(%rip), %rsi      # 0x603b
movq %rbx, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3270
jmp 0x3981
nopl (%rax)