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

    /* KMIP 1.1 Test Suite - Test 3.1.1.0a */
    uint8 expected[296] = {
        0x42, 0x00, 0x78, 0x01, 0x00, 0x00, 0x01, 0x20, 
        0x42, 0x00, 0x77, 0x01, 0x00, 0x00, 0x00, 0x38, 
        0x42, 0x00, 0x69, 0x01, 0x00, 0x00, 0x00, 0x20, 
        0x42, 0x00, 0x6A, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x6B, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x0D, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x0F, 0x01, 0x00, 0x00, 0x00, 0xD8, 
        0x42, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        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
    };
    
    uint8 observed[296] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), KMIP_1_1);
    
    /* TODO (ph) If protocol version omitted, pull from context? */
    struct protocol_version pv = {0};
    pv.major = 1;
    pv.minor = 1;
    
    struct request_header rh = {0};
    kmip_init_request_header(&rh);
    
    rh.protocol_version = &pv;
    rh.batch_count = 1;
    
    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 crp = {0};
    crp.object_type = KMIP_OBJTYPE_SYMMETRIC_KEY;
    crp.template_attribute = &ta;
    
    struct request_batch_item rbi = {0};
    kmip_init_request_batch_item(&rbi);
    rbi.operation = KMIP_OP_CREATE;
    rbi.request_payload = &crp;
    
    struct request_message rm = {0};
    rm.request_header = &rh;
    rm.batch_items = &rbi;
    rm.batch_count = 1;
    
    int result = kmip_encode_request_message(&ctx, &rm);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc10, %rsp            # imm = 0xC10
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x130(%rbp), %rdi
leaq 0x2d045(%rip), %rsi     # 0x46bd0
movl $0x128, %edx            # imm = 0x128
callq 0x10c0
leaq -0x260(%rbp), %rdi
xorl %esi, %esi
movl $0x128, %edx            # imm = 0x128
callq 0x1090
leaq -0xaf8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x260(%rbp), %rsi
leaq -0xaf8(%rbp), %rdi
movl $0x128, %edx            # imm = 0x128
movl $0x1, %ecx
callq 0x1c6e0
leaq -0xb00(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
movl $0x1, -0xb00(%rbp)
movl $0x1, -0xafc(%rbp)
leaq -0xb50(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x1090
leaq -0xb50(%rbp), %rdi
callq 0x1d4c0
leaq -0xb00(%rbp), %rax
movq %rax, -0xb50(%rbp)
movl $0x1, -0xb28(%rbp)
leaq -0xb80(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x1090
movl $0x0, -0xb84(%rbp)
cmpl $0x3, -0xb84(%rbp)
jge 0x19c87
movslq -0xb84(%rbp), %rax
leaq -0xb80(%rbp), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x1d330
movl -0xb84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb84(%rbp)
jmp 0x19c53
movl $0x3, -0xb88(%rbp)
movl $0x3, -0xb80(%rbp)
leaq -0xb88(%rbp), %rax
movq %rax, -0xb78(%rbp)
movl $0x80, -0xb8c(%rbp)
movl $0x4, -0xb70(%rbp)
leaq -0xb8c(%rbp), %rax
movq %rax, -0xb68(%rbp)
movl $0xc, -0xb90(%rbp)
movl $0x6, -0xb60(%rbp)
leaq -0xb90(%rbp), %rax
movq %rax, -0xb58(%rbp)
leaq -0xbb0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0xb80(%rbp), %rax
movq %rax, -0xba0(%rbp)
movq $0x3, -0xb98(%rbp)
leaq -0xbd0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
movl $0x2, -0xbd0(%rbp)
leaq -0xbb0(%rbp), %rax
movq %rax, -0xbc8(%rbp)
leaq -0xbf0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0xbf0(%rbp), %rdi
callq 0x1d5f0
movl $0x1, -0xbf0(%rbp)
leaq -0xbd0(%rbp), %rax
movq %rax, -0xbe0(%rbp)
leaq -0xc08(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0xb50(%rbp), %rax
movq %rax, -0xc08(%rbp)
leaq -0xbf0(%rbp), %rax
movq %rax, -0xc00(%rbp)
movq $0x1, -0xbf8(%rbp)
leaq -0xaf8(%rbp), %rdi
leaq -0xc08(%rbp), %rsi
callq 0x2a7f0
movl %eax, -0xc0c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x260(%rbp), %rcx
movl -0xc0c(%rbp), %r8d
leaq -0xaf8(%rbp), %rsi
leaq 0x275e9(%rip), %r9      # 0x413de
callq 0x11f0
movl %eax, -0xc0c(%rbp)
leaq -0xaf8(%rbp), %rdi
callq 0x1cab0
movl -0xc0c(%rbp), %eax
addq $0xc10, %rsp            # imm = 0xC10
popq %rbp
retq
nopl (%rax,%rax)