// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/tests/tests.c
// Function: test_decode_query_response_payload
int
test_decode_query_response_payload(TestTracker *tracker)
{
    TRACK_TEST(tracker);

    uint8 encoding[176] = {
        0x42, 0x00, 0x7C, 0x01, 0x00, 0x00, 0x00, 0x58,

        0x42, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,

        0x42, 0x00, 0x57, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x57, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,

        0x42, 0x00, 0x9D, 0x07, 0x00, 0x00, 0x00, 0x0A,
        0x56, 0x65, 0x6E, 0x64, 0x6F, 0x72, 0x20, 0x4F,
        0x6E, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    };

    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_0);

    struct text_string vendor = {0};
    vendor.value = "Vendor One";
    vendor.size = 10;

    // operations
    LinkedList oper_1  = {0};
    LinkedListItem item_1 = {0};
    int32 op_1 = KMIP_OP_CREATE;
    item_1.data = &op_1;

    LinkedListItem item_2 = {0};
    int32 op_2 = KMIP_OP_CREATE_KEY_PAIR;
    item_2.data = &op_2;

    kmip_linked_list_enqueue(&oper_1, &item_1);
    kmip_linked_list_enqueue(&oper_1, &item_2);

    Operations operations = {0};
    operations.operation_list = &oper_1;


    // objects
    LinkedList objlist  = {0};
    LinkedListItem obj_item_1 = {0};
    int32 obj_1 = KMIP_OBJTYPE_CERTIFICATE;
    obj_item_1.data = &obj_1;

    LinkedListItem obj_item_2 = {0};
    int32 obj_2 = KMIP_OBJTYPE_PUBLIC_KEY;
    obj_item_2.data = &obj_2;

    kmip_linked_list_enqueue(&objlist, &obj_item_1);
    kmip_linked_list_enqueue(&objlist, &obj_item_2);

    ObjectTypes objects = {0};
    objects.object_list = &objlist;

    struct query_response_payload expected = {0};
    expected.operations = &operations;
    expected.objects = &objects;
    expected.vendor_identification = &vendor;

    struct query_response_payload observed = {0};

    int result = kmip_decode_query_response_payload(&ctx, &observed);
    int comparison = kmip_compare_query_response_payload(&expected, &observed);
    if (!comparison)
    {
        kmip_print_query_response_payload(stderr, 1, &observed);
        kmip_print_query_response_payload(stderr, 1, &expected);
    }
    result = report_decoding_test_result(
        tracker,
        &ctx,
        comparison,
        result,
        __func__);
    kmip_free_query_response_payload(&ctx, &observed);
    kmip_destroy(&ctx);


    return (result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa88, %rsp            # imm = 0xA88
movq %rdi, 0x8(%rsp)
incw (%rdi)
leaq 0x21116(%rip), %rsi     # 0x32550
leaq 0x140(%rsp), %r15
movl $0xb0, %edx
movq %r15, %rdi
callq 0x1100
leaq 0x1f0(%rsp), %rbx
xorl %r13d, %r13d
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0xb0, %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x13177
leaq 0x1dfe6(%rip), %rax     # 0x2f468
leaq 0x70(%rsp), %rbp
movq %rax, (%rbp)
movq $0xa, 0x8(%rbp)
leaq 0x120(%rsp), %r15
movq %r13, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x100(%rsp), %rsi
movaps %xmm0, (%rsi)
movl $0x1, %ebx
leaq 0x1c(%rsp), %rax
movl %ebx, (%rax)
movq %rax, 0x10(%rsi)
leaq 0xe0(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x18(%rsp), %rax
movl $0x2, (%rax)
movq %rax, 0x10(%r12)
movq %r15, %rdi
callq 0x128ec
movq %r15, %rdi
movq %r12, %rsi
callq 0x128ec
leaq 0x28(%rsp), %r14
movq %r15, (%r14)
leaq 0xc0(%rsp), %r15
movq %r13, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0xa0(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0x14(%rsp), %rax
movl %ebx, (%rax)
movq %rax, 0x10(%rsi)
leaq 0x80(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x10(%rsp), %rax
movl $0x3, (%rax)
movq %rax, 0x10(%r12)
movq %r15, %rdi
callq 0x128ec
movq %r15, %rdi
movq %r12, %rsi
callq 0x128ec
leaq 0x20(%rsp), %rax
movq %r15, (%rax)
leaq 0x50(%rsp), %r15
movq %r13, 0x18(%r15)
movq %r14, (%r15)
movq %rax, 0x8(%r15)
movq %rbp, 0x10(%r15)
leaq 0x30(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x1f0(%rsp), %rdi
movq %r12, %rsi
callq 0x24d4c
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x16be1
testl %eax, %eax
jne 0x115cf
movq 0x31a4f(%rip), %rbx     # 0x42ff8
movq (%rbx), %rdi
leaq 0x30(%rsp), %rdx
movl $0x1, %esi
callq 0x2be80
movq (%rbx), %rdi
leaq 0x50(%rsp), %rdx
movl $0x1, %esi
callq 0x2be80
xorl %eax, %eax
leaq 0x1de9d(%rip), %r8      # 0x2f473
leaq 0x1f0(%rsp), %r14
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1363
movl %eax, %ebx
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x148df
movq %r14, %rdi
callq 0x13455
movl %ebx, %eax
addq $0xa88, %rsp            # imm = 0xA88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq