// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa60, %rsp            # imm = 0xA60
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x90(%rbp), %rdi
leaq 0x2d6a5(%rip), %rsi     # 0x46a60
movl $0x80, %edx
callq 0x10c0
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x90(%rbp), %rsi
leaq -0x928(%rbp), %rdi
movl $0x80, %edx
movl $0x5, %ecx
callq 0x1c6e0
leaq -0x938(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x27dc0(%rip), %rax     # 0x411cf
movq %rax, -0x938(%rbp)
movq $0x8, -0x930(%rbp)
leaq -0x948(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x27a46(%rip), %rax     # 0x40e81
movq %rax, -0x948(%rbp)
movq $0xc, -0x940(%rbp)
leaq -0x958(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x27edb(%rip), %rax     # 0x41342
movq %rax, -0x958(%rbp)
movq $0x4, -0x950(%rbp)
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x27eb4(%rip), %rax     # 0x41347
movq %rax, -0x968(%rbp)
movq $0x13, -0x960(%rbp)
leaq -0x978(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x27e9c(%rip), %rax     # 0x4135b
movq %rax, -0x978(%rbp)
movq $0x13, -0x970(%rbp)
leaq -0x980(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x998(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x9c8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x968(%rbp), %rax
movq %rax, -0x9a0(%rbp)
leaq -0x978(%rbp), %rax
movq %rax, -0x9b8(%rbp)
leaq -0x998(%rbp), %rdi
leaq -0x9b0(%rbp), %rsi
callq 0x1b660
leaq -0x998(%rbp), %rdi
leaq -0x9c8(%rbp), %rsi
callq 0x1b660
leaq -0x998(%rbp), %rax
movq %rax, -0x980(%rbp)
leaq -0xa10(%rbp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x1090
leaq -0x938(%rbp), %rax
movq %rax, -0xa10(%rbp)
leaq -0x948(%rbp), %rax
movq %rax, -0xa08(%rbp)
leaq -0x958(%rbp), %rax
movq %rax, -0xa00(%rbp)
leaq -0x980(%rbp), %rax
movq %rax, -0x9d0(%rbp)
leaq -0xa58(%rbp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x1090
leaq -0x928(%rbp), %rdi
leaq -0xa58(%rbp), %rsi
callq 0x37980
movl %eax, -0xa5c(%rbp)
leaq -0xa10(%rbp), %rdi
leaq -0xa58(%rbp), %rsi
callq 0x24920
movl %eax, -0xa60(%rbp)
cmpl $0x0, -0xa60(%rbp)
jne 0x19629
movq 0x3a9fe(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0xa10(%rbp), %rdx
callq 0x3e2e0
movq 0x3a9e3(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0xa58(%rbp), %rdx
callq 0x3e2e0
movq -0x8(%rbp), %rdi
movl -0xa60(%rbp), %edx
movl -0xa5c(%rbp), %ecx
leaq -0x928(%rbp), %rsi
leaq 0x27d28(%rip), %r8      # 0x4136f
callq 0x13a0
movl %eax, -0xa5c(%rbp)
leaq -0x928(%rbp), %rdi
leaq -0xa58(%rbp), %rsi
callq 0x1fce0
leaq -0x928(%rbp), %rdi
callq 0x1cab0
movl -0xa5c(%rbp), %eax
addq $0xa60, %rsp            # imm = 0xA60
popq %rbp
retq