// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
incw (%rdi)
movaps 0x2613d(%rip), %xmm0    # 0x33940
leaq 0xa0(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps 0x26119(%rip), %xmm0    # 0x33930
movaps %xmm0, (%r15)
movl $0x80000000, %eax       # imm = 0x80000000
movq %rax, 0x20(%r15)
leaq 0xd0(%rsp), %r14
xorl %ebx, %ebx
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 0x13747
leaq 0x80(%rsp), %r15
movq %rbx, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x60(%rsp), %r12
movq %rbx, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq %r13, %rdi
callq 0x13e59
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
movq %rbx, 0x10(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
leaq 0x20(%rsp), %rbp
movaps %xmm0, (%rbp)
movq %rbp, %rdi
callq 0x13e59
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 0x12ebd
movq %r15, %rdi
movq %r13, %rsi
callq 0x12ebd
leaq 0x10(%rsp), %r12
movq %r15, (%r12)
movq %rsp, %r15
movq %rbx, (%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x20532
movl %eax, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x165ac
movl %eax, %r14d
testl %eax, %eax
jne 0xd948
movq 0x376d2(%rip), %rbx     # 0x44ff8
movq (%rbx), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0x2cc9e
movq (%rbx), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0x2cc9e
leaq 0x2328a(%rip), %r8      # 0x30bd9
leaq 0xd0(%rsp), %r15
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x1397
movl %eax, %ebx
movq %rsp, %rsi
movq %r15, %rdi
callq 0x14275
movq %r15, %rdi
callq 0x13a23
movl %ebx, %eax
addq $0x968, %rsp            # imm = 0x968
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq