// File: /workspace/github_c_makefile_star2_O1/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 0xfce7
movl %eax, %ebp
leaq 0x1181b(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2045, %edx           # imm = 0x2045
jmp 0xfd19
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 0xfd29
movl %eax, %ebp
leaq 0x117e7(%rip), %rsi     # 0x214f8
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 0xfd56
movq %rbx, %rdi
movl $0x420093, %esi         # imm = 0x420093
callq 0x6c10
testl %eax, %eax
je 0xfd56
movl %eax, %ebp
leaq 0x117ac(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2050, %edx           # imm = 0x2050
jmp 0xfd19
movl 0x10(%r14), %edx
movq %rbx, %rdi
movl $0x42007f, %esi         # imm = 0x42007F
callq 0x66d0
testl %eax, %eax
je 0xfd7e
movl %eax, %ebp
leaq 0x11784(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2054, %edx           # imm = 0x2054
jmp 0xfd19
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xfdad
movq %rbx, %rdi
movl $0x42007e, %esi         # imm = 0x42007E
callq 0x66d0
testl %eax, %eax
je 0xfdad
movl %eax, %ebp
leaq 0x11758(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2059, %edx           # imm = 0x2059
jmp 0xfd19
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xfddd
movq %rbx, %rdi
movl $0x42007d, %esi         # imm = 0x42007D
callq 0x6670
testl %eax, %eax
je 0xfddd
movl %eax, %ebp
leaq 0x11728(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x205f, %edx           # imm = 0x205F
jmp 0xfd19
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xfe0d
movq %rbx, %rdi
movl $0x420006, %esi         # imm = 0x420006
callq 0x6c10
testl %eax, %eax
je 0xfe0d
movl %eax, %ebp
leaq 0x116f8(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2065, %edx           # imm = 0x2065
jmp 0xfd19
movl (%r14), %eax
cmpl $0x13, %eax
jg 0xfe2d
cmpl $0x1, %eax
je 0xfe5a
cmpl $0xa, %eax
jne 0xfe3c
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x61e0
jmp 0xfe74
cmpl $0x14, %eax
je 0xfe68
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x18, %eax
je 0xfe76
leaq 0x116b5(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x207b, %edx           # imm = 0x207B
callq 0x6de0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xfd1e
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6a70
jmp 0xfe74
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0x6ad0
movl %eax, %ebp
testl %ebp, %ebp
je 0xfe8e
leaq 0x11677(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x207f, %edx           # imm = 0x207F
jmp 0xfd19
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xfebe
movl %eax, %ebp
leaq 0x11647(%rip), %rsi     # 0x214f8
movq %rbx, %rdi
movl $0x2085, %edx           # imm = 0x2085
jmp 0xfd19
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xfd1e