// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x9b0, %rsp            # imm = 0x9B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x40(%rbp), %rdi
leaq 0x2d438(%rip), %rsi     # 0x46ae0
movl $0x38, %edx
callq 0x10c0
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x1090
leaq -0x918(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x80(%rbp), %rsi
leaq -0x918(%rbp), %rdi
movl $0x38, %edx
xorl %ecx, %ecx
callq 0x1c6e0
leaq -0x930(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x948(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x1, -0x94c(%rbp)
leaq -0x94c(%rbp), %rax
movq %rax, -0x938(%rbp)
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x2, -0x96c(%rbp)
leaq -0x96c(%rbp), %rax
movq %rax, -0x958(%rbp)
leaq -0x988(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x3, -0x98c(%rbp)
leaq -0x98c(%rbp), %rax
movq %rax, -0x978(%rbp)
leaq -0x930(%rbp), %rdi
leaq -0x948(%rbp), %rsi
callq 0x1b660
leaq -0x930(%rbp), %rdi
leaq -0x968(%rbp), %rsi
callq 0x1b660
leaq -0x930(%rbp), %rdi
leaq -0x988(%rbp), %rsi
callq 0x1b660
leaq -0x998(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x930(%rbp), %rax
movq %rax, -0x998(%rbp)
leaq -0x9a0(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x998(%rbp), %rax
movq %rax, -0x9a0(%rbp)
leaq -0x918(%rbp), %rdi
leaq -0x9a0(%rbp), %rsi
callq 0x2a370
movl %eax, -0x9a4(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
leaq -0x80(%rbp), %rcx
movl -0x9a4(%rbp), %r8d
leaq -0x918(%rbp), %rsi
leaq 0x27b59(%rip), %r9      # 0x4138e
callq 0x11f0
movl %eax, -0x9a4(%rbp)
movl -0x9a4(%rbp), %eax
addq $0x9b0, %rsp            # imm = 0x9B0
popq %rbp
retq
nop