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

    /* This encoding matches the following set of values:
    *  Operations
          OP_CREATE               = 0x01,
          OP_CREATE_KEY_PAIR      = 0x02,
    */
    uint8 encoding[32] = {
        0x42, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00
    };

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

    LinkedList list_1  = {0};
    LinkedListItem item_1 = {0};
    int32 op_1 = KMIP_OP_CREATE;
    item_1.data = &op_1;

    LinkedListItem item_2 = {0};
    int32 op_2 = KMIP_OP_CREATE_KEY_PAIR;
    item_2.data = &op_2;

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

    Operations expected = {0};
    expected.operation_list = &list_1;

    Operations observed = {0};
    int result = kmip_decode_operations(&ctx, &observed);
    int comparison = kmip_compare_operations(&expected, &observed);
    if(!comparison)
    {
        kmip_print_operations(stderr, 1, &expected);
        kmip_print_operations(stderr, 1, &observed);
    }
    result = report_decoding_test_result(tracker, &ctx, comparison, result, __func__);

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

    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x940, %rsp            # imm = 0x940
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
movq 0x2e36c(%rip), %rax     # 0x47320
movq %rax, -0x30(%rbp)
movq 0x2e369(%rip), %rax     # 0x47328
movq %rax, -0x28(%rbp)
movq 0x2e366(%rip), %rax     # 0x47330
movq %rax, -0x20(%rbp)
movq 0x2e363(%rip), %rax     # 0x47338
movq %rax, -0x18(%rbp)
leaq -0x8c8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x30(%rbp), %rsi
leaq -0x8c8(%rbp), %rdi
movl $0x20, %edx
xorl %ecx, %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
movl $0x1, -0x8fc(%rbp)
leaq -0x8fc(%rbp), %rax
movq %rax, -0x8e8(%rbp)
leaq -0x918(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x2, -0x91c(%rbp)
leaq -0x91c(%rbp), %rax
movq %rax, -0x908(%rbp)
leaq -0x8e0(%rbp), %rdi
leaq -0x8f8(%rbp), %rsi
callq 0x1b660
leaq -0x8e0(%rbp), %rdi
leaq -0x918(%rbp), %rsi
callq 0x1b660
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8e0(%rbp), %rax
movq %rax, -0x928(%rbp)
leaq -0x930(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8c8(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x373e0
movl %eax, -0x934(%rbp)
leaq -0x928(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x24680
movl %eax, -0x938(%rbp)
cmpl $0x0, -0x938(%rbp)
jne 0x19137
movq 0x3aef0(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x928(%rbp), %rdx
callq 0x3dfb0
movq 0x3aed5(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x930(%rbp), %rdx
callq 0x3dfb0
movq -0x8(%rbp), %rdi
movl -0x938(%rbp), %edx
movl -0x934(%rbp), %ecx
leaq -0x8c8(%rbp), %rsi
leaq 0x281bd(%rip), %r8      # 0x41312
callq 0x13a0
movl %eax, -0x934(%rbp)
leaq -0x8c8(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x1fb40
leaq -0x8c8(%rbp), %rdi
callq 0x1cab0
movl -0x934(%rbp), %eax
addq $0x940, %rsp            # imm = 0x940
popq %rbp
retq
nop