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

    uint8 expected[96] = {
        0x42, 0x00, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x58, 
        0x42, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x50, 
        0x42, 0x00, 0x42, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x45, 0x01, 0x00, 0x00, 0x00, 0x18, 
        0x42, 0x00, 0x43, 0x08, 0x00, 0x00, 0x00, 0x10, 
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 
        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[96] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), KMIP_1_0);
    
    uint8 value[16] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
    };
    struct byte_string key = {0};
    key.value = value;
    key.size = ARRAY_LENGTH(value);
    
    struct key_value kv = {0};
    kv.key_material = &key;
    
    struct key_block kb = {0};
    kb.key_format_type = KMIP_KEYFORMAT_RAW;
    kb.key_value = &kv;
    kb.cryptographic_algorithm = KMIP_CRYPTOALG_AES;
    kb.cryptographic_length = 128;
    
    struct symmetric_key sk = {0};
    sk.key_block = &kb;
    
    int result = kmip_encode_symmetric_key(&ctx, &sk);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9e0, %rsp            # imm = 0x9E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x70(%rbp), %rdi
leaq 0x35ea8(%rip), %rsi     # 0x42a30
movl $0x60, %edx
callq 0x10c0
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x1090
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0xd0(%rbp), %rsi
leaq -0x968(%rbp), %rdi
movl $0x60, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq 0x3a5d7(%rip), %rax     # 0x471b0
movq %rax, -0x980(%rbp)
movq 0x3a5d1(%rip), %rax     # 0x471b8
movq %rax, -0x978(%rbp)
leaq -0x990(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x980(%rbp), %rax
movq %rax, -0x990(%rbp)
movq $0x10, -0x988(%rbp)
leaq -0x9a8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x990(%rbp), %rax
movq %rax, -0x9a8(%rbp)
leaq -0x9d0(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
movl $0x1, -0x9d0(%rbp)
leaq -0x9a8(%rbp), %rax
movq %rax, -0x9c8(%rbp)
movl $0x3, -0x9bc(%rbp)
movl $0x80, -0x9b8(%rbp)
leaq -0x9d8(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x9d0(%rbp), %rax
movq %rax, -0x9d8(%rbp)
leaq -0x968(%rbp), %rdi
leaq -0x9d8(%rbp), %rsi
callq 0x27b70
movl %eax, -0x9dc(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
movl -0x9dc(%rbp), %r8d
leaq -0x968(%rbp), %rsi
leaq 0x33390(%rip), %r9      # 0x40068
callq 0x11f0
movl %eax, -0x9dc(%rbp)
leaq -0x968(%rbp), %rdi
callq 0x1cab0
movl -0x9dc(%rbp), %eax
addq $0x9e0, %rsp            # imm = 0x9E0
popq %rbp
retq
nop