// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x968, %rsp            # imm = 0x968
movq %rdi, %rbx
incw (%rdi)
movaps 0x1d9b1(%rip), %xmm0    # 0x2a930
leaq 0xa0(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps 0x1d98d(%rip), %xmm0    # 0x2a920
movaps %xmm0, (%r15)
movl $0x80000000, %eax       # imm = 0x80000000
movq %rax, 0x20(%r15)
leaq 0xd0(%rsp), %r14
movl $0x898, %edx            # imm = 0x898
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
pushq $0x28
popq %rdx
pushq $0x5
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x128ed
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x60(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq %r13, %rdi
callq 0x12e6d
pushq $0x3
popq %rax
leaq 0x1c(%rsp), %rcx
movl %eax, (%rcx)
movl %eax, (%r13)
movq %rcx, 0x8(%r13)
movq %r13, 0x10(%r12)
leaq 0x40(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
leaq 0x20(%rsp), %rbp
movaps %xmm0, (%rbp)
movq %rbp, %rdi
callq 0x12e6d
leaq 0x18(%rsp), %rax
movl $0x80, (%rax)
movl $0x4, (%rbp)
movq %rax, 0x8(%rbp)
movq %rbp, 0x10(%r13)
movq %r15, %rdi
movq %r12, %rsi
callq 0x12233
movq %r15, %rdi
movq %r13, %rsi
callq 0x12233
leaq 0x10(%rsp), %r12
movq %r15, (%r12)
leaq 0x8(%rsp), %r15
andq $0x0, (%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1c766
movl %eax, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x14f4e
movl %eax, %r14d
testl %eax, %eax
jne 0xd0bb
movq 0x30f63(%rip), %r12     # 0x3dff8
movq (%r12), %rdi
pushq $0x1
popq %r15
leaq 0x10(%rsp), %rdx
movl %r15d, %esi
callq 0x24261
movq (%r12), %rdi
leaq 0x8(%rsp), %rdx
movl %r15d, %esi
callq 0x24261
leaq 0x1ab17(%rip), %r8      # 0x27bd9
leaq 0xd0(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x134d
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x131ec
movq %r15, %rdi
callq 0x12ade
movl %ebx, %eax
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq