// File: /workspace/github_c_makefile_star2_O2/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 $0xa78, %rsp            # imm = 0xA78
movq %rdi, %rbx
incw (%rdi)
leaq 0x1a766(%rip), %rsi     # 0x2b550
leaq 0x130(%rsp), %r15
movl $0xb0, %edx
movq %r15, %rdi
callq 0x1100
leaq 0x1e0(%rsp), %r14
movl $0x898, %edx            # imm = 0x898
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0xb0, %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x128ed
leaq 0x17639(%rip), %rax     # 0x28468
leaq 0x60(%rsp), %r13
movq %rax, (%r13)
movq $0xa, 0x8(%r13)
xorps %xmm0, %xmm0
leaq 0x110(%rsp), %r15
andq $0x0, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0xf0(%rsp), %rsi
movaps %xmm0, (%rsi)
pushq $0x1
popq %r14
leaq 0xc(%rsp), %rax
movl %r14d, (%rax)
movq %rax, 0x10(%rsi)
leaq 0xd0(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x8(%rsp), %rax
movl $0x2, (%rax)
movq %rax, 0x10(%r12)
movq %r15, %rdi
callq 0x12233
movq %r15, %rdi
movq %r12, %rsi
callq 0x12233
leaq 0x18(%rsp), %rbp
leaq 0xb0(%rsp), %r12
andq $0x0, 0x10(%r12)
movq %r15, (%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0x4(%rsp), %rax
movl %r14d, (%rax)
movq %rax, 0x10(%rsi)
leaq 0x70(%rsp), %r15
movaps %xmm0, (%r15)
movq %rsp, %rax
movl $0x3, (%rax)
movq %rax, 0x10(%r15)
movq %r12, %rdi
callq 0x12233
movq %r12, %rdi
movq %r15, %rsi
callq 0x12233
leaq 0x40(%rsp), %r15
andq $0x0, 0x18(%r15)
leaq 0x10(%rsp), %rax
movq %r12, (%rax)
movq %rbp, (%r15)
movq %rax, 0x8(%r15)
movq %r13, 0x10(%r15)
leaq 0x20(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x1e0(%rsp), %rdi
movq %r12, %rsi
callq 0x1f544
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x15b84
movl %eax, %r14d
testl %eax, %eax
jne 0x10f7f
movq 0x2d09f(%rip), %r12     # 0x3dff8
movq (%r12), %rdi
pushq $0x1
popq %r15
leaq 0x20(%rsp), %rdx
movl %r15d, %esi
callq 0x247e8
movq (%r12), %rdi
leaq 0x40(%rsp), %rdx
movl %r15d, %esi
callq 0x247e8
leaq 0x174ed(%rip), %r8      # 0x28473
leaq 0x1e0(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x134d
movl %eax, %ebx
leaq 0x20(%rsp), %rsi
movq %r15, %rdi
callq 0x13bf9
movq %r15, %rdi
callq 0x12ade
movl %ebx, %eax
addq $0xa78, %rsp            # imm = 0xA78
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq