// File: /workspace/github_c_makefile_star2_O2/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 0xe8c9
movl %eax, %ebp
leaq 0x940b(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2045, %edx           # imm = 0x2045
jmp 0xe8fb
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
movq %rbx, %rdi
movl $0x42005c, %esi         # imm = 0x42005C
callq 0x6700
testl %eax, %eax
je 0xe90b
movl %eax, %ebp
leaq 0x93d7(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x204b, %edx           # imm = 0x204B
callq 0x6e80
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0xe938
movq %rbx, %rdi
movl $0x420093, %esi         # imm = 0x420093
callq 0x6cb0
testl %eax, %eax
je 0xe938
movl %eax, %ebp
leaq 0x939c(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2050, %edx           # imm = 0x2050
jmp 0xe8fb
movl 0x10(%r14), %edx
movq %rbx, %rdi
movl $0x42007f, %esi         # imm = 0x42007F
callq 0x6700
testl %eax, %eax
je 0xe960
movl %eax, %ebp
leaq 0x9374(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2054, %edx           # imm = 0x2054
jmp 0xe8fb
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xe98f
movq %rbx, %rdi
movl $0x42007e, %esi         # imm = 0x42007E
callq 0x6700
testl %eax, %eax
je 0xe98f
movl %eax, %ebp
leaq 0x9348(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2059, %edx           # imm = 0x2059
jmp 0xe8fb
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xe9bf
movq %rbx, %rdi
movl $0x42007d, %esi         # imm = 0x42007D
callq 0x66a0
testl %eax, %eax
je 0xe9bf
movl %eax, %ebp
leaq 0x9318(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x205f, %edx           # imm = 0x205F
jmp 0xe8fb
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xe9ef
movq %rbx, %rdi
movl $0x420006, %esi         # imm = 0x420006
callq 0x6cb0
testl %eax, %eax
je 0xe9ef
movl %eax, %ebp
leaq 0x92e8(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2065, %edx           # imm = 0x2065
jmp 0xe8fb
movl (%r14), %eax
cmpl $0x18, %eax
je 0xea64
cmpl $0xa, %eax
je 0xea14
cmpl $0x14, %eax
je 0xea22
cmpl $0x1, %eax
jne 0xea7b
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6b00
jmp 0xea2e
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x61f0
jmp 0xea2e
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6b60
movl %eax, %ebp
testl %eax, %eax
jne 0xea67
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6b10
testl %eax, %eax
je 0xea97
movl %eax, %ebp
leaq 0x9273(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x2085, %edx           # imm = 0x2085
jmp 0xe8fb
pushq $-0x1
popq %rbp
leaq 0x925c(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x207f, %edx           # imm = 0x207F
jmp 0xe8fb
leaq 0x9248(%rip), %rsi      # 0x17cca
movq %rbx, %rdi
movl $0x207b, %edx           # imm = 0x207B
callq 0x6e80
pushq $-0x1
popq %rbp
jmp 0xe900
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xe900