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

    /* This encoding matches the following set of values:
    *  Attributes
    *      Cryptographic Algorithm - AES
    *      Cryptographic Length - 128
    */
    uint8 expected[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
    };
    
    uint8 observed[40] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), 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 attributes = {0};
    attributes.attribute_list = &attribute_list;

    int result = kmip_encode_attributes(&ctx, &attributes);
    result = report_encoding_test_result(tracker, &ctx, expected, observed, result, __func__);

    kmip_destroy(&ctx);

    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x980, %rsp            # imm = 0x980
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x30(%rbp), %rdi
leaq 0x33668(%rip), %rsi     # 0x45610
movl $0x28, %edx
callq 0x10c0
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x60(%rbp), %rsi
leaq -0x8f8(%rbp), %rdi
movl $0x28, %edx
movl $0x5, %ecx
callq 0x1c6e0
leaq -0x910(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
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 $0x3, -0x93c(%rbp)
movl $0x3, -0x938(%rbp)
leaq -0x93c(%rbp), %rax
movq %rax, -0x930(%rbp)
leaq -0x938(%rbp), %rax
movq %rax, -0x918(%rbp)
leaq -0x958(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x968(%rbp), %rdi
callq 0x1d330
movl $0x80, -0x96c(%rbp)
movl $0x4, -0x968(%rbp)
leaq -0x96c(%rbp), %rax
movq %rax, -0x960(%rbp)
leaq -0x968(%rbp), %rax
movq %rax, -0x948(%rbp)
leaq -0x910(%rbp), %rdi
leaq -0x928(%rbp), %rsi
callq 0x1b660
leaq -0x910(%rbp), %rdi
leaq -0x958(%rbp), %rsi
callq 0x1b660
leaq -0x978(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x910(%rbp), %rax
movq %rax, -0x978(%rbp)
leaq -0x8f8(%rbp), %rdi
leaq -0x978(%rbp), %rsi
callq 0x26980
movl %eax, -0x97c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rdx
leaq -0x60(%rbp), %rcx
movl -0x97c(%rbp), %r8d
leaq -0x8f8(%rbp), %rsi
leaq 0x2e6c0(%rip), %r9      # 0x40807
callq 0x11f0
movl %eax, -0x97c(%rbp)
leaq -0x8f8(%rbp), %rdi
callq 0x1cab0
movl -0x97c(%rbp), %eax
addq $0x980, %rsp            # imm = 0x980
popq %rbp
retq
nopl (%rax)