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

    uint8 encoding[200] = {
        0x42, 0x00, 0x79, 0x01, 0x00, 0x00, 0x00, 0xC0, 
        0x42, 0x00, 0x57, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x91, 0x01, 0x00, 0x00, 0x00, 0xA8, 
        0x42, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x30, 
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x17, 
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72, 
        0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x41, 0x6C, 
        0x67, 0x6F, 0x72, 0x69, 0x74, 0x68, 0x6D, 0x00, 
        0x42, 0x00, 0x0B, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x30, 
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x14, 
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72, 
        0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x4C, 0x65, 
        0x6E, 0x67, 0x74, 0x68, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x30, 
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x18, 
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72, 
        0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x55, 0x73, 
        0x61, 0x67, 0x65, 0x20, 0x4D, 0x61, 0x73, 0x6B, 
        0x42, 0x00, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00
    };
    
    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_0);
    
    struct attribute a[3] = {0};
    for(int i = 0; i < 3; i++)
    {
        kmip_init_attribute(&a[i]);
    }
    
    enum cryptographic_algorithm algorithm = KMIP_CRYPTOALG_AES;
    a[0].type = KMIP_ATTR_CRYPTOGRAPHIC_ALGORITHM;
    a[0].value = &algorithm;
    
    int32 length = 128;
    a[1].type = KMIP_ATTR_CRYPTOGRAPHIC_LENGTH;
    a[1].value = &length;
    
    int32 mask = KMIP_CRYPTOMASK_ENCRYPT | KMIP_CRYPTOMASK_DECRYPT;
    a[2].type = KMIP_ATTR_CRYPTOGRAPHIC_USAGE_MASK;
    a[2].value = &mask;
    
    struct template_attribute ta = {0};
    ta.attributes = a;
    ta.attribute_count = ARRAY_LENGTH(a);
    
    struct create_request_payload expected = {0};
    expected.object_type = KMIP_OBJTYPE_SYMMETRIC_KEY;
    expected.template_attribute = &ta;
    
    struct create_request_payload observed = {0};
    
    int result = kmip_decode_create_request_payload(&ctx, &observed);
    result = report_decoding_test_result(
        tracker,
        &ctx,
        kmip_compare_create_request_payload(&expected, &observed),
        result,
        __func__);
    kmip_free_create_request_payload(&ctx, &observed);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa20, %rsp            # imm = 0xA20
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0xd0(%rbp), %rdi
leaq 0x36545(%rip), %rsi     # 0x44420
movl $0xc8, %edx
callq 0x10c0
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0xd0(%rbp), %rsi
leaq -0x968(%rbp), %rdi
movl $0xc8, %edx
xorl %ecx, %ecx
callq 0x1c6e0
leaq -0x9a0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x1090
movl $0x0, -0x9a4(%rbp)
cmpl $0x3, -0x9a4(%rbp)
jge 0xdf63
movslq -0x9a4(%rbp), %rax
leaq -0x9a0(%rbp), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x1d330
movl -0x9a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9a4(%rbp)
jmp 0xdf2f
movl $0x3, -0x9a8(%rbp)
movl $0x3, -0x9a0(%rbp)
leaq -0x9a8(%rbp), %rax
movq %rax, -0x998(%rbp)
movl $0x80, -0x9ac(%rbp)
movl $0x4, -0x990(%rbp)
leaq -0x9ac(%rbp), %rax
movq %rax, -0x988(%rbp)
movl $0xc, -0x9b0(%rbp)
movl $0x6, -0x980(%rbp)
leaq -0x9b0(%rbp), %rax
movq %rax, -0x978(%rbp)
leaq -0x9d0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0x9a0(%rbp), %rax
movq %rax, -0x9c0(%rbp)
movq $0x3, -0x9b8(%rbp)
leaq -0x9f0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
movl $0x2, -0x9f0(%rbp)
leaq -0x9d0(%rbp), %rax
movq %rax, -0x9e8(%rbp)
leaq -0xa10(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0x968(%rbp), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x31bd0
movl %eax, -0xa14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa20(%rbp)
leaq -0x9f0(%rbp), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x22560
movq -0xa20(%rbp), %rdi
movl %eax, %edx
movl -0xa14(%rbp), %ecx
leaq -0x968(%rbp), %rsi
leaq 0x32135(%rip), %r8      # 0x401bc
callq 0x13a0
movl %eax, -0xa14(%rbp)
leaq -0x968(%rbp), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x1e5e0
leaq -0x968(%rbp), %rdi
callq 0x1cab0
movl -0xa14(%rbp), %eax
addq $0xa20, %rsp            # imm = 0xA20
popq %rbp
retq