// File: /workspace/github_c_makefile_star2_O2/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_cryptographic_parameters
int
kmip_encode_cryptographic_parameters(KMIP *ctx, const CryptographicParameters *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_CRYPTOGRAPHIC_PARAMETERS, KMIP_TYPE_STRUCTURE));
    CHECK_RESULT(ctx, result);
    
    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;
    
    if(value->block_cipher_mode != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_BLOCK_CIPHER_MODE, value->block_cipher_mode);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->padding_method != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_PADDING_METHOD, value->padding_method);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->hashing_algorithm != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_HASHING_ALGORITHM, value->hashing_algorithm);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->key_role_type != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_KEY_ROLE_TYPE, value->key_role_type);
        CHECK_RESULT(ctx, result);
    }
    
    if(ctx->version >= KMIP_1_2)
    {
        if(value->digital_signature_algorithm != 0)
        {
            result = kmip_encode_enum(ctx, KMIP_TAG_DIGITAL_SIGNATURE_ALGORITHM, value->digital_signature_algorithm);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->cryptographic_algorithm != 0)
        {
            result = kmip_encode_enum(ctx, KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM, value->cryptographic_algorithm);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->random_iv != KMIP_UNSET)
        {
            result = kmip_encode_bool(ctx, KMIP_TAG_RANDOM_IV, value->random_iv);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->iv_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_IV_LENGTH, value->iv_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->tag_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_TAG_LENGTH, value->tag_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->fixed_field_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_FIXED_FIELD_LENGTH, value->fixed_field_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->invocation_field_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_INVOCATION_FIELD_LENGTH, value->invocation_field_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->counter_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_COUNTER_LENGTH, value->counter_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->initial_counter_value != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_INITIAL_COUNTER_VALUE, value->initial_counter_value);
            CHECK_RESULT(ctx, result);
        }
    }
    
    if(ctx->version >= KMIP_1_4)
    {
        if(value->salt_length != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_SALT_LENGTH, value->salt_length);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->mask_generator != 0)
        {
            result = kmip_encode_enum(ctx, KMIP_TAG_MASK_GENERATOR, value->mask_generator);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->mask_generator_hashing_algorithm != 0)
        {
            result = kmip_encode_enum(ctx, KMIP_TAG_MASK_GENERATOR_HASHING_ALGORITHM, value->mask_generator_hashing_algorithm);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->p_source != NULL)
        {
            result = kmip_encode_byte_string(ctx, KMIP_TAG_P_SOURCE, value->p_source);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->trailer_field != KMIP_UNSET)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_TRAILER_FIELD, value->trailer_field);
            CHECK_RESULT(ctx, result);
        }
    }
    
    uint8 *curr_index = ctx->index;
    ctx->index = length_index;
    
    result = kmip_encode_length(ctx, curr_index - value_index);
    CHECK_RESULT(ctx, result);

    ctx->index = curr_index;
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x42002b01, %esi       # imm = 0x42002B01
callq 0x60a0
testl %eax, %eax
je 0xc10a
movl %eax, %ebp
leaq 0xb877(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b2f, %edx           # imm = 0x1B2F
callq 0x6e80
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
testl %edx, %edx
je 0xc142
movq %rbx, %rdi
movl $0x420011, %esi         # imm = 0x420011
callq 0x6700
testl %eax, %eax
je 0xc142
movl %eax, %ebp
leaq 0xb831(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b37, %edx           # imm = 0x1B37
jmp 0xc0fa
movl 0x4(%r14), %edx
testl %edx, %edx
je 0xc16e
movq %rbx, %rdi
movl $0x42005f, %esi         # imm = 0x42005F
callq 0x6700
testl %eax, %eax
je 0xc16e
movl %eax, %ebp
leaq 0xb805(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b3d, %edx           # imm = 0x1B3D
jmp 0xc0fa
movl 0x8(%r14), %edx
testl %edx, %edx
je 0xc19d
movq %rbx, %rdi
movl $0x420038, %esi         # imm = 0x420038
callq 0x6700
testl %eax, %eax
je 0xc19d
movl %eax, %ebp
leaq 0xb7d9(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b43, %edx           # imm = 0x1B43
jmp 0xc0fa
movl 0xc(%r14), %edx
testl %edx, %edx
je 0xc1cc
movq %rbx, %rdi
movl $0x420083, %esi         # imm = 0x420083
callq 0x6700
testl %eax, %eax
je 0xc1cc
movl %eax, %ebp
leaq 0xb7aa(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b49, %edx           # imm = 0x1B49
jmp 0xc0fa
cmpl $0x2, 0x18(%rbx)
jb 0xc47c
movl 0x10(%r14), %edx
testl %edx, %edx
je 0xc205
movq %rbx, %rdi
movl $0x4200ae, %esi         # imm = 0x4200AE
callq 0x6700
testl %eax, %eax
je 0xc205
movl %eax, %ebp
leaq 0xb771(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b51, %edx           # imm = 0x1B51
jmp 0xc0fa
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xc234
movq %rbx, %rdi
movl $0x420028, %esi         # imm = 0x420028
callq 0x6700
testl %eax, %eax
je 0xc234
movl %eax, %ebp
leaq 0xb742(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b57, %edx           # imm = 0x1B57
jmp 0xc0fa
movl 0x18(%r14), %edx
cmpl $-0x1, %edx
je 0xc264
movq %rbx, %rdi
movl $0x4200c5, %esi         # imm = 0x4200C5
callq 0x6590
testl %eax, %eax
je 0xc264
movl %eax, %ebp
leaq 0xb712(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b5d, %edx           # imm = 0x1B5D
jmp 0xc0fa
movl 0x1c(%r14), %edx
cmpl $-0x1, %edx
je 0xc294
movq %rbx, %rdi
movl $0x4200cd, %esi         # imm = 0x4200CD
callq 0x63f0
testl %eax, %eax
je 0xc294
movl %eax, %ebp
leaq 0xb6e2(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b63, %edx           # imm = 0x1B63
jmp 0xc0fa
movl 0x20(%r14), %edx
cmpl $-0x1, %edx
je 0xc2c4
movq %rbx, %rdi
movl $0x4200ce, %esi         # imm = 0x4200CE
callq 0x63f0
testl %eax, %eax
je 0xc2c4
movl %eax, %ebp
leaq 0xb6b2(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b69, %edx           # imm = 0x1B69
jmp 0xc0fa
movl 0x24(%r14), %edx
cmpl $-0x1, %edx
je 0xc2f4
movq %rbx, %rdi
movl $0x4200cf, %esi         # imm = 0x4200CF
callq 0x63f0
testl %eax, %eax
je 0xc2f4
movl %eax, %ebp
leaq 0xb682(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b6f, %edx           # imm = 0x1B6F
jmp 0xc0fa
movl 0x28(%r14), %edx
cmpl $-0x1, %edx
je 0xc324
movq %rbx, %rdi
movl $0x4200d2, %esi         # imm = 0x4200D2
callq 0x63f0
testl %eax, %eax
je 0xc324
movl %eax, %ebp
leaq 0xb652(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b75, %edx           # imm = 0x1B75
jmp 0xc0fa
movl 0x2c(%r14), %edx
cmpl $-0x1, %edx
je 0xc354
movq %rbx, %rdi
movl $0x4200d0, %esi         # imm = 0x4200D0
callq 0x63f0
testl %eax, %eax
je 0xc354
movl %eax, %ebp
leaq 0xb622(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b7b, %edx           # imm = 0x1B7B
jmp 0xc0fa
movl 0x30(%r14), %edx
cmpl $-0x1, %edx
je 0xc384
movq %rbx, %rdi
movl $0x4200d1, %esi         # imm = 0x4200D1
callq 0x63f0
testl %eax, %eax
je 0xc384
movl %eax, %ebp
leaq 0xb5f2(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b81, %edx           # imm = 0x1B81
jmp 0xc0fa
cmpl $0x4, 0x18(%rbx)
jb 0xc47c
movl 0x34(%r14), %edx
cmpl $-0x1, %edx
je 0xc3be
movq %rbx, %rdi
movl $0x420100, %esi         # imm = 0x420100
callq 0x63f0
testl %eax, %eax
je 0xc3be
movl %eax, %ebp
leaq 0xb5b8(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b8a, %edx           # imm = 0x1B8A
jmp 0xc0fa
movl 0x38(%r14), %edx
testl %edx, %edx
je 0xc3ed
movq %rbx, %rdi
movl $0x420101, %esi         # imm = 0x420101
callq 0x6700
testl %eax, %eax
je 0xc3ed
movl %eax, %ebp
leaq 0xb589(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b90, %edx           # imm = 0x1B90
jmp 0xc0fa
movl 0x3c(%r14), %edx
testl %edx, %edx
je 0xc41c
movq %rbx, %rdi
movl $0x420102, %esi         # imm = 0x420102
callq 0x6700
testl %eax, %eax
je 0xc41c
movl %eax, %ebp
leaq 0xb55a(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b96, %edx           # imm = 0x1B96
jmp 0xc0fa
movq 0x40(%r14), %rdx
testq %rdx, %rdx
je 0xc44c
movq %rbx, %rdi
movl $0x420103, %esi         # imm = 0x420103
callq 0x6cb0
testl %eax, %eax
je 0xc44c
movl %eax, %ebp
leaq 0xb52a(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1b9c, %edx           # imm = 0x1B9C
jmp 0xc0fa
movl 0x48(%r14), %edx
cmpl $-0x1, %edx
je 0xc47c
movq %rbx, %rdi
movl $0x420104, %esi         # imm = 0x420104
callq 0x63f0
testl %eax, %eax
je 0xc47c
movl %eax, %ebp
leaq 0xb4fa(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1ba2, %edx           # imm = 0x1BA2
jmp 0xc0fa
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6b10
testl %eax, %eax
je 0xc4ac
movl %eax, %ebp
leaq 0xb4ca(%rip), %rsi      # 0x17969
movq %rbx, %rdi
movl $0x1baa, %edx           # imm = 0x1BAA
jmp 0xc0fa
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xc0ff