// File: /workspace/github_c_makefile_star2_O3/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 0x2137d(%rip), %rsi     # 0x32490
leaq 0x150(%rsp), %r15
movl $0x10, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1d0(%rsp), %rbx
xorl %r13d, %r13d
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 0x13177
leaq 0x1e12b(%rip), %rax     # 0x2f287
leaq 0x50(%rsp), %rbp
movq %rax, (%rbp)
movq $0x8, 0x8(%rbp)
leaq 0x1ddc5(%rip), %rax     # 0x2ef39
leaq 0x40(%rsp), %rbx
movq %rax, (%rbx)
movq $0xc, 0x8(%rbx)
leaq 0x1e26f(%rip), %rax     # 0x2f3fa
leaq 0x30(%rsp), %r14
movq %rax, (%r14)
movq $0x4, 0x8(%r14)
leaq 0x1e25d(%rip), %rax     # 0x2f3ff
leaq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movl $0x13, %eax
movq %rax, 0x8(%rcx)
leaq 0x1e259(%rip), %rdx     # 0x2f413
leaq 0x10(%rsp), %rdi
movq %rdx, (%rdi)
movq %rax, 0x8(%rdi)
leaq 0xd0(%rsp), %r15
movq %r13, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0xb0(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0xf0(%rsp), %rsi
movq %rcx, 0x10(%rsi)
movq %rdi, 0x10(%r12)
movq %r15, %rdi
callq 0x128ec
movq %r15, %rdi
movq %r12, %rsi
callq 0x128ec
leaq 0x8(%rsp), %rax
movq %r15, (%rax)
leaq 0x108(%rsp), %r15
movq %r13, 0x38(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movq %rbp, (%r15)
movq %rbx, 0x8(%r15)
movq %r14, 0x10(%r15)
movq %rax, 0x40(%r15)
leaq 0x60(%rsp), %r12
movq %r13, 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 0x28697
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x176f0
testl %eax, %eax
jne 0x112ac
movq 0x31d75(%rip), %rbx     # 0x42ff8
movq (%rbx), %rdi
leaq 0x108(%rsp), %rdx
movl $0x1, %esi
callq 0x2cc8f
movq (%rbx), %rdi
leaq 0x60(%rsp), %rdx
movl $0x1, %esi
callq 0x2cc8f
xorl %eax, %eax
leaq 0x1e174(%rip), %r8      # 0x2f427
leaq 0x1d0(%rsp), %r14
movq (%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1363
movl %eax, %ebx
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x15330
movq %r14, %rdi
callq 0x13455
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq