// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_request_batch_item
int
kmip_encode_request_batch_item(KMIP *ctx, const RequestBatchItem *value)
{
    CHECK_ENCODE_ARGS(ctx, 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(ctx->version >= KMIP_2_0)
    {
        if(value->ephemeral != KMIP_UNSET)
        {
            result=kmip_encode_bool(ctx, KMIP_TAG_EPHEMERAL, value->ephemeral);
            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);
    }
    
    switch(value->operation)
    {
        case KMIP_OP_CREATE:
        result = kmip_encode_create_request_payload(ctx, (CreateRequestPayload*)value->request_payload);
        break;
        
        case KMIP_OP_GET:
        result = kmip_encode_get_request_payload(ctx, (GetRequestPayload*)value->request_payload);
        break;
        
        case KMIP_OP_DESTROY:
        result = kmip_encode_destroy_request_payload(ctx, (DestroyRequestPayload*)value->request_payload);
        break;
        
        case KMIP_OP_QUERY:
        result = kmip_encode_query_request_payload(ctx, (QueryRequestPayload*)value->request_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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x15c73
movl $0xffffffef, -0x4(%rbp) # imm = 0xFFFFFFEF
jmp 0x15efb
cmpq $0x0, -0x18(%rbp)
jne 0x15c86
movl $0x0, -0x4(%rbp)
jmp 0x15efb
jmp 0x15c88
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42000f01, %esi       # imm = 0x42000F01
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15cc6
movq -0x10(%rbp), %rdi
leaq 0xf55e(%rip), %rsi      # 0x2520f
movl $0x2005, %edx           # imm = 0x2005
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15cc8
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 $0x42005c, %esi         # imm = 0x42005C
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15d25
movq -0x10(%rbp), %rdi
leaq 0xf4ff(%rip), %rsi      # 0x2520f
movl $0x200b, %edx           # imm = 0x200B
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15d27
movq -0x10(%rbp), %rax
cmpl $0x5, 0x18(%rax)
jb 0x15d7f
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
je 0x15d7d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %edx
movl $0x420154, %esi         # imm = 0x420154
callq 0x65e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15d79
movq -0x10(%rbp), %rdi
leaq 0xf4ab(%rip), %rsi      # 0x2520f
movl $0x2012, %edx           # imm = 0x2012
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15d7b
jmp 0x15d7d
jmp 0x15d7f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x15dcd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x420093, %esi         # imm = 0x420093
callq 0x6d40
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15dc9
movq -0x10(%rbp), %rdi
leaq 0xf45b(%rip), %rsi      # 0x2520f
movl $0x2019, %edx           # imm = 0x2019
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15dcb
jmp 0x15dcd
movq -0x18(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x17, %eax
ja 0x15e4c
movq -0x40(%rbp), %rax
leaq 0xeafd(%rip), %rcx      # 0x248e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x68f0
movl %eax, -0x1c(%rbp)
jmp 0x15e6d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6180
movl %eax, -0x1c(%rbp)
jmp 0x15e6d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6240
movl %eax, -0x1c(%rbp)
jmp 0x15e6d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6580
movl %eax, -0x1c(%rbp)
jmp 0x15e6d
movq -0x10(%rbp), %rdi
leaq 0xf3b8(%rip), %rsi      # 0x2520f
movl $0x202f, %edx           # imm = 0x202F
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x15efb
jmp 0x15e6f
cmpl $0x0, -0x1c(%rbp)
je 0x15e92
movq -0x10(%rbp), %rdi
leaq 0xf38f(%rip), %rsi      # 0x2520f
movl $0x2033, %edx           # imm = 0x2033
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15e94
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 0x15ee6
movq -0x10(%rbp), %rdi
leaq 0xf33b(%rip), %rsi      # 0x2520f
movl $0x2039, %edx           # imm = 0x2039
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15efb
jmp 0x15ee8
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)