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


    /* This encoding matches the following set of values:

    Tag: Server information (0x420088), Type: Structure (0x01), Data:
      Tag: Server Name (0x42012D) , Type: Text (0x07), Data: server 1
      Tag: Server Serial Number (0x42012E), Type: Text (0x07), Data: serNum123456
      Tag: Server Version (0x42012F), Type: Text (0x07), Data: 1.00
      Tag: Alt endpoint (0x420135), Type: Text (0x07), Data: server2.example.com
      Tag: Alt endpoint (0x420135), Type: Text (0x07), Data: server3.example.com
    */

    uint8 encoding[] = {
        0x42, 0x00, 0x88, 0x01, 0x00, 0x00, 0x00, 0x30,
        0x42, 0x01, 0x2D, 0x07, 0x00, 0x00, 0x00, 0x08,
        0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x31,
        0x42, 0x01, 0x2E, 0x07, 0x00, 0x00, 0x00, 0x0C,
        0x73, 0x65, 0x72, 0x4E, 0x75, 0x6D, 0x31, 0x32,
        0x33, 0x34, 0x35, 0x36, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x01, 0x2F, 0x07, 0x00, 0x00, 0x00, 0x04,
        0x31, 0x2E, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x01, 0x35, 0x07, 0x00, 0x00, 0x00, 0x13,
        0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x32, 0x2E,
        0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E,
        0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x01, 0x35, 0x07, 0x00, 0x00, 0x00, 0x13,
        0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x33, 0x2E,
        0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E,
        0x63, 0x6F, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00,

    };

    KMIP ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_2_0);

    TextString server_name = {0};
    server_name.value = "server 1";
    server_name.size = 8;

    TextString server_serial_number = {0};
    server_serial_number.value = "serNum123456";
    server_serial_number.size = 12;

    TextString server_version = {0};
    server_version.value = "1.00";
    server_version.size = 4;


    TextString alt_endpoint_1 = {0};
    alt_endpoint_1.value = "server2.example.com";
    alt_endpoint_1.size = 19;

    TextString alt_endpoint_2 = {0};
    alt_endpoint_2.value = "server3.example.com";
    alt_endpoint_2.size = 19;


    AltEndpoints alt = {0};
    LinkedList list_1 = {0};
    LinkedListItem item_1, item_2 = {0};
    item_1.data = &alt_endpoint_1;
    item_2.data = &alt_endpoint_2;
    kmip_linked_list_enqueue(&list_1, &item_1);
    kmip_linked_list_enqueue(&list_1, &item_2);
    alt.endpoint_list = &list_1;


    ServerInformation expected = {0};
    expected.server_name = &server_name;
    expected.server_serial_number = &server_serial_number;
    expected.server_version = &server_version;
    expected.alternative_failover_endpoints = &alt;

    ServerInformation observed = {0};
    int result = kmip_decode_server_information(&ctx, &observed);
    int comparison = kmip_compare_server_information(&expected, &observed);
    if(!comparison)
    {
        kmip_print_server_information(stderr, 1, &expected);
        kmip_print_server_information(stderr, 1, &observed);
    }
    result = report_decoding_test_result(tracker, &ctx, comparison, result, __func__);

    kmip_free_server_information(&ctx, &observed);
    kmip_destroy(&ctx);

    return (result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa68, %rsp            # imm = 0xA68
movq %rdi, (%rsp)
incw (%rdi)
leaq 0x22ea7(%rip), %rsi     # 0x344a0
leaq 0x150(%rsp), %r15
movl $0x10, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1d0(%rsp), %rbx
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x80, %edx
movq %rbx, %rdi
movq %r15, %rsi
movl $0x5, %ecx
callq 0x13747
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rbp
movaps %xmm0, (%rbp)
leaq 0x1fc3c(%rip), %rax     # 0x31287
movq %rax, (%rbp)
movq $0x8, 0x8(%rbp)
leaq 0x40(%rsp), %r14
movaps %xmm0, (%r14)
leaq 0x1f8d2(%rip), %rax     # 0x30f39
movq %rax, (%r14)
movq $0xc, 0x8(%r14)
leaq 0x30(%rsp), %rbx
movaps %xmm0, (%rbx)
leaq 0x1fd79(%rip), %rax     # 0x313fa
movq %rax, (%rbx)
movq $0x4, 0x8(%rbx)
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x1fd64(%rip), %rcx     # 0x313ff
movq %rcx, (%rax)
movl $0x13, %ecx
movq %rcx, 0x8(%rax)
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
leaq 0x1fd5d(%rip), %rsi     # 0x31413
movq %rsi, (%rdx)
movq %rcx, 0x8(%rdx)
leaq 0x8(%rsp), %r13
xorl %ecx, %ecx
movq %rcx, (%r13)
leaq 0xd0(%rsp), %r15
movq %rcx, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0xb0(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0xe8(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq %rdx, 0x10(%r12)
movq %r15, %rdi
callq 0x12ebd
movq %r15, %rdi
movq %r12, %rsi
callq 0x12ebd
movq %r15, (%r13)
leaq 0x100(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movq %rbp, (%r15)
movq %r14, 0x8(%r15)
movq %rbx, 0x10(%r15)
movq %r13, 0x40(%r15)
leaq 0x60(%rsp), %r12
xorl %eax, %eax
movq %rax, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x1d0(%rsp), %rdi
movq %r12, %rsi
callq 0x29950
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x17f17
movl %eax, %r14d
testl %eax, %eax
jne 0x117af
movq 0x33870(%rip), %rbx     # 0x44ff8
movq (%rbx), %rdi
leaq 0x100(%rsp), %rdx
movl $0x1, %esi
callq 0x2e073
movq (%rbx), %rdi
leaq 0x60(%rsp), %rdx
movl $0x1, %esi
callq 0x2e073
leaq 0x1fc71(%rip), %r8      # 0x31427
leaq 0x1d0(%rsp), %r15
movq (%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x1397
movl %eax, %ebx
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x158e1
movq %r15, %rdi
callq 0x13a23
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq