// File: /workspace/github_c_makefile_star2_O2/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, %rbx
incw (%rdi)
leaq 0x1a9c6(%rip), %rsi     # 0x2b490
pushq $0x10
popq %rcx
leaq 0x150(%rsp), %r15
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1d0(%rsp), %r14
movl $0x898, %edx            # imm = 0x898
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
pushq $0x5
popq %rcx
movl $0x80, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x128ed
leaq 0x1777b(%rip), %rax     # 0x28287
leaq 0x50(%rsp), %r13
movq %rax, (%r13)
movq $0x8, 0x8(%r13)
leaq 0x17415(%rip), %rax     # 0x27f39
leaq 0x40(%rsp), %rbp
movq %rax, (%rbp)
movq $0xc, 0x8(%rbp)
leaq 0x178be(%rip), %rax     # 0x283fa
leaq 0x30(%rsp), %r14
movq %rax, (%r14)
movq $0x4, 0x8(%r14)
leaq 0x178ac(%rip), %rax     # 0x283ff
leaq 0x20(%rsp), %rcx
movq %rax, (%rcx)
pushq $0x13
popq %rax
movq %rax, 0x8(%rcx)
leaq 0x178aa(%rip), %rdx     # 0x28413
leaq 0x10(%rsp), %rdi
movq %rdx, (%rdi)
movq %rax, 0x8(%rdi)
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0xb0(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0xf0(%rsp), %rsi
movq %rcx, 0x10(%rsi)
movq %rdi, 0x10(%r12)
movq %r15, %rdi
callq 0x12233
movq %r15, %rdi
movq %r12, %rsi
callq 0x12233
leaq 0x8(%rsp), %rax
movq %r15, (%rax)
leaq 0x108(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
andq $0x0, 0x38(%r15)
movq %r13, (%r15)
movq %rbp, 0x8(%r15)
movq %r14, 0x10(%r15)
movq %rax, 0x40(%r15)
leaq 0x60(%rsp), %r12
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
andq $0x0, 0x40(%r12)
leaq 0x1d0(%rsp), %rdi
movq %r12, %rsi
callq 0x21485
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x16624
movl %eax, %r14d
testl %eax, %eax
jne 0x10c61
movq 0x2d3c0(%rip), %r12     # 0x3dff8
movq (%r12), %rdi
pushq $0x1
popq %r15
leaq 0x108(%rsp), %rdx
movl %r15d, %esi
callq 0x25566
movq (%r12), %rdi
leaq 0x60(%rsp), %rdx
movl %r15d, %esi
callq 0x25566
leaq 0x177bf(%rip), %r8      # 0x28427
leaq 0x1d0(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x134d
movl %eax, %ebx
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x14432
movq %r15, %rdi
callq 0x12ade
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq