// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_key_wrapping_data
int
kmip_encode_key_wrapping_data(KMIP *ctx, const KeyWrappingData *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_KEY_WRAPPING_DATA, KMIP_TYPE_STRUCTURE));
    CHECK_RESULT(ctx, result);
    
    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;
    
    result = kmip_encode_enum(ctx, KMIP_TAG_WRAPPING_METHOD, value->wrapping_method);
    CHECK_RESULT(ctx, result);
    
    if(value->encryption_key_info != NULL)
    {
        result = kmip_encode_encryption_key_information(ctx, value->encryption_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->mac_signature_key_info != NULL)
    {
        result = kmip_encode_mac_signature_key_information(ctx, value->mac_signature_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->mac_signature != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_MAC_SIGNATURE, value->mac_signature);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->iv_counter_nonce != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_IV_COUNTER_NONCE, value->iv_counter_nonce);
        CHECK_RESULT(ctx, result);
    }
    
    if(ctx->version >= KMIP_1_1)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_ENCODING_OPTION, value->encoding_option);
        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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42004601, %esi       # imm = 0x42004601
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12cbe
movq -0x10(%rbp), %rdi
leaq 0x1229a(%rip), %rsi     # 0x24f43
movl $0x1bf2, %edx           # imm = 0x1BF2
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12cc0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rax
addq $0x4, %rax
movq %rax, 0x8(%rcx)
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movl $0x42009e, %esi         # imm = 0x42009E
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12d1d
movq -0x10(%rbp), %rdi
leaq 0x1223b(%rip), %rsi     # 0x24f43
movl $0x1bf8, %edx           # imm = 0x1BF8
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12d1f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12d68
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6400
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12d64
movq -0x10(%rbp), %rdi
leaq 0x121f4(%rip), %rsi     # 0x24f43
movl $0x1bfd, %edx           # imm = 0x1BFD
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12d66
jmp 0x12d68
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x12db1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6dd0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12dad
movq -0x10(%rbp), %rdi
leaq 0x121ab(%rip), %rsi     # 0x24f43
movl $0x1c03, %edx           # imm = 0x1C03
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12daf
jmp 0x12db1
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x12dff
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
movl $0x42004d, %esi         # imm = 0x42004D
callq 0x6d40
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12dfb
movq -0x10(%rbp), %rdi
leaq 0x1215d(%rip), %rsi     # 0x24f43
movl $0x1c09, %edx           # imm = 0x1C09
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12dfd
jmp 0x12dff
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x12e4d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
movl $0x42003d, %esi         # imm = 0x42003D
callq 0x6d40
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12e49
movq -0x10(%rbp), %rdi
leaq 0x1210f(%rip), %rsi     # 0x24f43
movl $0x1c0f, %edx           # imm = 0x1C0F
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12e4b
jmp 0x12e4d
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jb 0x12e96
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x28(%rax), %edx
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12e92
movq -0x10(%rbp), %rdi
leaq 0x120c3(%rip), %rsi     # 0x24f43
movl $0x1c15, %edx           # imm = 0x1C15
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12e94
jmp 0x12e96
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x12ee8
movq -0x10(%rbp), %rdi
leaq 0x1206d(%rip), %rsi     # 0x24f43
movl $0x1c1c, %edx           # imm = 0x1C1C
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12efd
jmp 0x12eea
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)