// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_create_request_payload
int
kmip_encode_create_request_payload(KMIP *ctx, const CreateRequestPayload *value)
{
    CHECK_ENCODE_ARGS(ctx, value);

    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_REQUEST_PAYLOAD, 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_OBJECT_TYPE, value->object_type);
    CHECK_RESULT(ctx, result);

    if(ctx->version < KMIP_2_0)
    {
        result = kmip_encode_template_attribute(ctx, value->template_attribute);
        CHECK_RESULT(ctx, result);
    }
    else
    {
        if(value->attributes)
        {
            result = kmip_encode_attributes(ctx, value->attributes);
            CHECK_RESULT(ctx, result);
        }
        else if(value->template_attribute)
        {
            Attributes *attributes = ctx->calloc_func(ctx->state, 1, sizeof(Attributes));
            LinkedList *list = ctx->calloc_func(ctx->state, 1, sizeof(LinkedList));
            attributes->attribute_list = list;
            for(size_t i = 0; i < value->template_attribute->attribute_count; i++)
            {
                LinkedListItem *item = ctx->calloc_func(ctx->state, 1, sizeof(LinkedListItem));
                item->data = kmip_deep_copy_attribute(ctx, &value->template_attribute->attributes[i]);
                kmip_linked_list_enqueue(list, item);
            }

            result = kmip_encode_attributes(ctx, attributes);

            kmip_free_attributes(ctx, attributes);
            ctx->free_func(ctx->state, attributes);

            CHECK_RESULT(ctx, result);
        }

        if(value->protection_storage_masks != NULL)
        {
            result = kmip_encode_protection_storage_masks(ctx, value->protection_storage_masks);
            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 $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x13d03
movl $0xffffffef, -0x4(%rbp) # imm = 0xFFFFFFEF
jmp 0x1404e
cmpq $0x0, -0x18(%rbp)
jne 0x13d16
movl $0x0, -0x4(%rbp)
jmp 0x1404e
jmp 0x13d18
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42007901, %esi       # imm = 0x42007901
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13d56
movq -0x10(%rbp), %rdi
leaq 0x112fb(%rip), %rsi     # 0x2503c
movl $0x1d77, %edx           # imm = 0x1D77
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13d58
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 $0x420057, %esi         # imm = 0x420057
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13db5
movq -0x10(%rbp), %rdi
leaq 0x1129c(%rip), %rsi     # 0x2503c
movl $0x1d7d, %edx           # imm = 0x1D7D
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13db7
movq -0x10(%rbp), %rax
cmpl $0x5, 0x18(%rax)
jae 0x13e02
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6dc0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13dfb
movq -0x10(%rbp), %rdi
leaq 0x11256(%rip), %rsi     # 0x2503c
movl $0x1d82, %edx           # imm = 0x1D82
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13dfd
jmp 0x13fe7
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x13e4e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6390
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13e47
movq -0x10(%rbp), %rdi
leaq 0x1120a(%rip), %rsi     # 0x2503c
movl $0x1d89, %edx           # imm = 0x1D89
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13e49
jmp 0x13f9f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x13f9d
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq *%rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x18, %edx
callq *%rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jae 0x13f3a
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x18, %edx
callq *%rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rsi
movq -0x48(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x62f0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x67e0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x13ebc
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x6390
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x6ed0
movq -0x10(%rbp), %rax
movq 0x878(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movq -0x38(%rbp), %rsi
callq *%rax
cmpl $0x0, -0x1c(%rbp)
je 0x13f99
movq -0x10(%rbp), %rdi
leaq 0x110b8(%rip), %rsi     # 0x2503c
movl $0x1d9c, %edx           # imm = 0x1D9C
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13f9b
jmp 0x13f9d
jmp 0x13f9f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x13fe5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x64a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13fe1
movq -0x10(%rbp), %rdi
leaq 0x1106d(%rip), %rsi     # 0x2503c
movl $0x1da2, %edx           # imm = 0x1DA2
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x13fe3
jmp 0x13fe5
jmp 0x13fe7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14039
movq -0x10(%rbp), %rdi
leaq 0x11015(%rip), %rsi     # 0x2503c
movl $0x1daa, %edx           # imm = 0x1DAA
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1404e
jmp 0x1403b
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)