// File: /workspace/github_c_makefile_star2_O3/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 0x244a6(%rip), %xmm0    # 0x31930
leaq 0xa0(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps 0x24482(%rip), %xmm0    # 0x31920
movaps %xmm0, (%r15)
movl $0x80000000, %eax       # imm = 0x80000000
movq %rax, 0x20(%r15)
leaq 0xd0(%rsp), %r14
xorl %r12d, %r12d
movl $0x898, %edx            # imm = 0x898
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x28, %edx
movq %r14, %rdi
movq %r15, %rsi
movl $0x5, %ecx
callq 0x13177
leaq 0x80(%rsp), %r15
movq %r12, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x60(%rsp), %r12
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq %r13, %rdi
callq 0x1388b
movl $0x3, %eax
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 0x1388b
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 0x128ec
movq %r15, %rdi
movq %r13, %rsi
callq 0x128ec
leaq 0x10(%rsp), %r12
movq %r15, (%r12)
leaq 0x8(%rsp), %r15
xorl %eax, %eax
movq %rax, (%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1f6b9
movl %eax, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x15f60
testl %eax, %eax
jne 0xd5cc
movq 0x35a52(%rip), %r14     # 0x42ff8
movq (%r14), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0x2b8ba
movq (%r14), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0x2b8ba
xorl %eax, %eax
leaq 0x21606(%rip), %r8      # 0x2ebd9
leaq 0xd0(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1363
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x13c9e
movq %r14, %rdi
callq 0x13455
movl %ebx, %eax
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq