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

    /* This encoding matches the following set of values:
    *  Request Payload
    *      Object Type - Query
    *      Query Functions
               Query Operations)
               Query Objects)
               Query Server Information)

    Tag: Request Payload (0x420079), Type: Structure (0x01), Data:
      Tag: Query Function (0x420074), Type: Enumeration (0x05), Data: 0x00000001 (Query Operations)
      Tag: Query Function (0x420074), Type: Enumeration (0x05), Data: 0x00000002 (Query Objects)
      Tag: Query Function (0x420074), Type: Enumeration (0x05), Data: 0x00000003 (Query Server Information)
    */

    uint8 expected[56] = {
        0x42, 0x00, 0x79, 0x01, 0x00, 0x00, 0x00, 0x30,
        0x42, 0x00, 0x74, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x74, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x74, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00
    };

    uint8 observed[56] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), KMIP_1_0);

    LinkedList list_1 = {0};

    LinkedListItem item_1 = {0};
    int32 funct_1 = KMIP_QUERY_OPERATIONS;
    item_1.data = &funct_1;

    LinkedListItem item_2 = {0};
    int32 funct_2 = KMIP_QUERY_OBJECTS;
    item_2.data = &funct_2;

    LinkedListItem item_3 = {0};
    int32 funct_3 = KMIP_QUERY_SERVER_INFORMATION;
    item_3.data = &funct_3;

    kmip_linked_list_enqueue(&list_1, &item_1);
    kmip_linked_list_enqueue(&list_1, &item_2);
    kmip_linked_list_enqueue(&list_1, &item_3);

    Functions functions = {0};
    functions.function_list = &list_1;

    QueryRequestPayload qrp = {0};
    qrp.functions = &functions;

    int result = kmip_encode_query_request_payload(&ctx, &qrp);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__);

    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x978, %rsp            # imm = 0x978
movq %rdi, %rbx
incw (%rdi)
xorl %r13d, %r13d
leaq 0xa0(%rsp), %r14
movq %r13, 0x30(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0xe0(%rsp), %r15
movl $0x898, %edx            # imm = 0x898
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x38, %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x13177
leaq 0x80(%rsp), %r12
movq %r13, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
leaq 0x60(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0xc(%rsp), %rax
movl $0x1, (%rax)
movq %rax, 0x10(%rsi)
leaq 0x40(%rsp), %r13
movaps %xmm0, (%r13)
leaq 0x8(%rsp), %rax
movl $0x2, (%rax)
movq %rax, 0x10(%r13)
leaq 0x20(%rsp), %rbp
movaps %xmm0, (%rbp)
leaq 0x4(%rsp), %rax
movl $0x3, (%rax)
movq %rax, 0x10(%rbp)
movq %r12, %rdi
callq 0x128ec
movq %r12, %rdi
movq %r13, %rsi
callq 0x128ec
movq %r12, %rdi
movq %rbp, %rsi
callq 0x128ec
leaq 0x18(%rsp), %rax
movq %r12, (%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x1b181
leaq 0x21120(%rip), %rdx     # 0x32510
leaq 0x1e04f(%rip), %r9      # 0x2f446
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
movl %eax, %r8d
callq 0x123c
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq