// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_response_batch_item
int
kmip_encode_response_batch_item(KMIP *ctx, const ResponseBatchItem *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_BATCH_ITEM, 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_OPERATION, value->operation);
    CHECK_RESULT(ctx, result);
    
    if(value->unique_batch_item_id != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_UNIQUE_BATCH_ITEM_ID, value->unique_batch_item_id);
        CHECK_RESULT(ctx, result);
    }
    
    result = kmip_encode_enum(ctx, KMIP_TAG_RESULT_STATUS, value->result_status);
    CHECK_RESULT(ctx, result);
    
    if(value->result_reason != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_RESULT_REASON, value->result_reason);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->result_message != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_RESULT_MESSAGE, value->result_message);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->asynchronous_correlation_value != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_ASYNCHRONOUS_CORRELATION_VALUE, value->asynchronous_correlation_value);
        CHECK_RESULT(ctx, result);
    }
    
    switch(value->operation)
    {
        case KMIP_OP_CREATE:
        result = kmip_encode_create_response_payload(ctx, (CreateResponsePayload*)value->response_payload);
        break;
        
        case KMIP_OP_GET:
        result = kmip_encode_get_response_payload(ctx, (GetResponsePayload*)value->response_payload);
        break;
        
        case KMIP_OP_DESTROY:
        result = kmip_encode_destroy_response_payload(ctx, (DestroyResponsePayload*)value->response_payload);
        break;
        
        case KMIP_OP_QUERY:
        result = kmip_encode_query_response_payload(ctx, (QueryResponsePayload*)value->response_payload);
        break;

        default:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
    };
    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 $0x42000f01, %esi       # imm = 0x42000F01
callq 0x60a0
testl %eax, %eax
je 0xf8f6
movl %eax, %ebp
leaq 0x10c7c(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2045, %edx           # imm = 0x2045
jmp 0xf928
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
movq %rbx, %rdi
movl $0x42005c, %esi         # imm = 0x42005C
callq 0x66d0
testl %eax, %eax
je 0xf938
movl %eax, %ebp
leaq 0x10c48(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x204b, %edx           # imm = 0x204B
callq 0x6de0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0xf965
movq %rbx, %rdi
movl $0x420093, %esi         # imm = 0x420093
callq 0x6c10
testl %eax, %eax
je 0xf965
movl %eax, %ebp
leaq 0x10c0d(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2050, %edx           # imm = 0x2050
jmp 0xf928
movl 0x10(%r14), %edx
movq %rbx, %rdi
movl $0x42007f, %esi         # imm = 0x42007F
callq 0x66d0
testl %eax, %eax
je 0xf98d
movl %eax, %ebp
leaq 0x10be5(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2054, %edx           # imm = 0x2054
jmp 0xf928
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xf9bc
movq %rbx, %rdi
movl $0x42007e, %esi         # imm = 0x42007E
callq 0x66d0
testl %eax, %eax
je 0xf9bc
movl %eax, %ebp
leaq 0x10bb9(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2059, %edx           # imm = 0x2059
jmp 0xf928
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xf9ec
movq %rbx, %rdi
movl $0x42007d, %esi         # imm = 0x42007D
callq 0x6670
testl %eax, %eax
je 0xf9ec
movl %eax, %ebp
leaq 0x10b89(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x205f, %edx           # imm = 0x205F
jmp 0xf928
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xfa1c
movq %rbx, %rdi
movl $0x420006, %esi         # imm = 0x420006
callq 0x6c10
testl %eax, %eax
je 0xfa1c
movl %eax, %ebp
leaq 0x10b59(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2065, %edx           # imm = 0x2065
jmp 0xf928
movl (%r14), %eax
cmpl $0x13, %eax
jg 0xfa3c
cmpl $0x1, %eax
je 0xfa69
cmpl $0xa, %eax
jne 0xfa4b
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x61e0
jmp 0xfa83
cmpl $0x14, %eax
je 0xfa77
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x18, %eax
je 0xfa89
leaq 0x10b16(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x207b, %edx           # imm = 0x207B
callq 0x6de0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xf92d
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6a70
jmp 0xfa83
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6ad0
movl %eax, %ebp
testl %eax, %eax
je 0xfa9d
leaq 0x10ad8(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x207f, %edx           # imm = 0x207F
jmp 0xf928
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xfacd
movl %eax, %ebp
leaq 0x10aa8(%rip), %rsi     # 0x20568
movq %rbx, %rdi
movl $0x2085, %edx           # imm = 0x2085
jmp 0xf928
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xf92d