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

    /* This encoding matches the following set of values:
    *  Attributes
    *      Cryptographic Algorithm - AES
    *      Cryptographic Length - 128
    */
    uint8 encoding[40] = {
        0x42, 0x01, 0x25, 0x01, 0x00, 0x00, 0x00, 0x20,
        0x42, 0x00, 0x28, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x2A, 0x02, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00
    };

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

    LinkedList attribute_list = {0};

    LinkedListItem item_1 = {0};
    Attribute attr_1 = {0};
    kmip_init_attribute(&attr_1);
    enum cryptographic_algorithm algorithm = KMIP_CRYPTOALG_AES;
    attr_1.type = KMIP_ATTR_CRYPTOGRAPHIC_ALGORITHM;
    attr_1.value = &algorithm;
    item_1.data = &attr_1;

    LinkedListItem item_2 = {0};
    Attribute attr_2 = {0};
    kmip_init_attribute(&attr_2);
    int32 length = 128;
    attr_2.type = KMIP_ATTR_CRYPTOGRAPHIC_LENGTH;
    attr_2.value = &length;
    item_2.data = &attr_2;

    kmip_linked_list_enqueue(&attribute_list, &item_1);
    kmip_linked_list_enqueue(&attribute_list, &item_2);

    Attributes expected = {0};
    expected.attribute_list = &attribute_list;

    Attributes observed = {0};
    int result = kmip_decode_attributes(&ctx, &observed);
    int comparison = kmip_compare_attributes(&expected, &observed);
    if(!comparison)
    {
        kmip_print_attributes(stderr, 1, &expected);
        kmip_print_attributes(stderr, 1, &observed);
    }
    result = report_decoding_test_result(tracker, &ctx, comparison, result, __func__);

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

    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x960, %rsp            # imm = 0x960
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x30(%rbp), %rdi
leaq 0x32018(%rip), %rsi     # 0x45710
movl $0x28, %edx
callq 0x10c0
leaq -0x8c8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x30(%rbp), %rsi
leaq -0x8c8(%rbp), %rdi
movl $0x28, %edx
movl $0x5, %ecx
callq 0x1c6e0
leaq -0x8e0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x908(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x908(%rbp), %rdi
callq 0x1d330
movl $0x3, -0x90c(%rbp)
movl $0x3, -0x908(%rbp)
leaq -0x90c(%rbp), %rax
movq %rax, -0x900(%rbp)
leaq -0x908(%rbp), %rax
movq %rax, -0x8e8(%rbp)
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x938(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x938(%rbp), %rdi
callq 0x1d330
movl $0x80, -0x93c(%rbp)
movl $0x4, -0x938(%rbp)
leaq -0x93c(%rbp), %rax
movq %rax, -0x930(%rbp)
leaq -0x938(%rbp), %rax
movq %rax, -0x918(%rbp)
leaq -0x8e0(%rbp), %rdi
leaq -0x8f8(%rbp), %rsi
callq 0x1b660
leaq -0x8e0(%rbp), %rdi
leaq -0x928(%rbp), %rsi
callq 0x1b660
leaq -0x948(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8e0(%rbp), %rax
movq %rax, -0x948(%rbp)
leaq -0x950(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8c8(%rbp), %rdi
leaq -0x950(%rbp), %rsi
callq 0x2f100
movl %eax, -0x954(%rbp)
leaq -0x948(%rbp), %rdi
leaq -0x950(%rbp), %rsi
callq 0x21580
movl %eax, -0x958(%rbp)
cmpl $0x0, -0x958(%rbp)
jne 0x138d1
movq 0x40756(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x948(%rbp), %rdx
callq 0x3c720
movq 0x4073b(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x950(%rbp), %rdx
callq 0x3c720
movq -0x8(%rbp), %rdi
movl -0x958(%rbp), %edx
movl -0x954(%rbp), %ecx
leaq -0x8c8(%rbp), %rsi
leaq 0x2d232(%rip), %r8      # 0x40b21
callq 0x13a0
movl %eax, -0x954(%rbp)
leaq -0x8c8(%rbp), %rdi
leaq -0x950(%rbp), %rsi
callq 0x1db80
leaq -0x8c8(%rbp), %rdi
callq 0x1cab0
movl -0x954(%rbp), %eax
addq $0x960, %rsp            # imm = 0x960
popq %rbp
retq
nopl (%rax,%rax)