// File: /workspace/github_c_makefile_star2_O1/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_response_batch_item
int
kmip_decode_response_batch_item(KMIP *ctx, ResponseBatchItem *value)
{
    CHECK_BUFFER_FULL(ctx, 8);
    
    int result = 0;
    int32 tag_type = 0;
    uint32 length = 0;
    
    kmip_decode_int32_be(ctx, &tag_type);
    CHECK_TAG_TYPE(ctx, tag_type, KMIP_TAG_BATCH_ITEM, KMIP_TYPE_STRUCTURE);
    
    kmip_decode_length(ctx, &length);
    CHECK_BUFFER_FULL(ctx, length);
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_OPERATION))
    {
        result = kmip_decode_enum(ctx, KMIP_TAG_OPERATION, &value->operation);
        CHECK_RESULT(ctx, result);
        CHECK_ENUM(ctx, KMIP_TAG_OPERATION, value->operation);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_UNIQUE_BATCH_ITEM_ID))
    {
        value->unique_batch_item_id = ctx->calloc_func(ctx->state, 1, sizeof(ByteString));
        CHECK_NEW_MEMORY(ctx, value->unique_batch_item_id, sizeof(ByteString), "UniqueBatchItemID byte string");
        
        result = kmip_decode_byte_string(ctx, KMIP_TAG_UNIQUE_BATCH_ITEM_ID, value->unique_batch_item_id);
        CHECK_RESULT(ctx, result);
    }
    
    result = kmip_decode_enum(ctx, KMIP_TAG_RESULT_STATUS, &value->result_status);
    CHECK_RESULT(ctx, result);
    CHECK_ENUM(ctx, KMIP_TAG_RESULT_STATUS, value->result_status);
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_RESULT_REASON))
    {
        result = kmip_decode_enum(ctx, KMIP_TAG_RESULT_REASON, &value->result_reason);
        CHECK_RESULT(ctx, result);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_RESULT_MESSAGE))
    {
        value->result_message = ctx->calloc_func(ctx->state, 1, sizeof(TextString));
        CHECK_NEW_MEMORY(ctx, value->result_message, sizeof(TextString), "ResultMessage text string");
        
        result = kmip_decode_text_string(ctx, KMIP_TAG_RESULT_MESSAGE, value->result_message);
        CHECK_RESULT(ctx, result);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_ASYNCHRONOUS_CORRELATION_VALUE))
    {
        value->asynchronous_correlation_value = ctx->calloc_func(ctx->state, 1, sizeof(ByteString));
        CHECK_NEW_MEMORY(ctx, value->asynchronous_correlation_value, sizeof(ByteString), "AsynchronousCorrelationValue byte string");
        
        result = kmip_decode_byte_string(ctx, KMIP_TAG_ASYNCHRONOUS_CORRELATION_VALUE, value->asynchronous_correlation_value);
        CHECK_RESULT(ctx, result);
    }
    
    /* NOTE (ph) Omitting the tag check is a good way to test error output. */
    if(kmip_is_tag_next(ctx, KMIP_TAG_RESPONSE_PAYLOAD))
    {
        switch(value->operation)
        {
            case KMIP_OP_CREATE:
            value->response_payload = ctx->calloc_func(ctx->state, 1, sizeof(CreateResponsePayload));
            CHECK_NEW_MEMORY(ctx, value->response_payload, sizeof(CreateResponsePayload), "CreateResponsePayload structure");
            result = kmip_decode_create_response_payload(ctx, value->response_payload);
            break;
            
            case KMIP_OP_GET:
            value->response_payload = ctx->calloc_func(ctx->state, 1, sizeof(GetResponsePayload));
            CHECK_NEW_MEMORY(ctx, value->response_payload, sizeof(GetResponsePayload), "GetResponsePayload structure");
            
            result = kmip_decode_get_response_payload(ctx, value->response_payload);
            break;
            
            case KMIP_OP_DESTROY:
            value->response_payload = ctx->calloc_func(ctx->state, 1, sizeof(DestroyResponsePayload));
            CHECK_NEW_MEMORY(ctx, value->response_payload, sizeof(DestroyResponsePayload), "DestroyResponsePayload structure");
            result = kmip_decode_destroy_response_payload(ctx, value->response_payload);
            break;
            
            case KMIP_OP_QUERY:
            value->response_payload = ctx->calloc_func(ctx->state, 1, sizeof(QueryResponsePayload));
            CHECK_NEW_MEMORY(ctx, value->response_payload, sizeof(QueryResponsePayload), "QueryResponsePayload structure");
            result = kmip_decode_query_response_payload(ctx, value->response_payload);
            break;

            default:
            kmip_push_error_frame(ctx, __func__, __LINE__);
            return(KMIP_NOT_IMPLEMENTED);
            break;
        };
        CHECK_RESULT(ctx, result);
    }
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
addq (%rdi), %rax
cmpq $0x7, %rax
ja 0x196d8
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rbx, %rbx
je 0x19cc3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x19798
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x196ba
jmp 0x19cc3
movq %rsi, %r14
xorl %eax, %eax
leaq 0x4(%rsp), %r15
movl %eax, (%r15)
movl %eax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6a10
movl (%r15), %eax
movl %eax, %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
cmpl $0x42000f00, %ecx       # imm = 0x42000F00
jne 0x19769
cmpb $0x1, %al
jne 0x197c4
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64b0
movq 0x10(%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rax, %rcx
addq (%rbx), %rcx
movl (%r15), %edx
cmpq %rdx, %rcx
jae 0x1981f
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rbx, %rbx
je 0x19cc3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x19896
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x1974b
jmp 0x19cc3
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
testq %rbx, %rbx
je 0x19cc3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x197f3
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x1977e
jmp 0x19cc3
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x729b(%rip), %rsi      # 0x20a44
movl $0x63, %edx
callq 0x66f0
movl $0x28b4, 0x9c(%rbx,%r14) # imm = 0x28B4
jmp 0x19cc3
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
testq %rbx, %rbx
je 0x19cc3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x197f3
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x197d9
jmp 0x19cc3
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x7240(%rip), %rsi      # 0x20a44
movl $0x63, %edx
callq 0x66f0
movl $0x28bb, 0x9c(%rbx,%r14) # imm = 0x28BB
jmp 0x19cc3
testq %rbx, %rbx
je 0x19968
cmpq $0x3, %rcx
jb 0x198e8
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x42005c, %eax         # imm = 0x42005C
jne 0x198e8
movq %rbx, %rdi
movl $0x42005c, %esi         # imm = 0x42005C
movq %r14, %rdx
callq 0x6ae0
testl %eax, %eax
je 0x198c2
movl %eax, %ebp
testq %rbx, %rbx
je 0x19cc3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x19bf1
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x19878
jmp 0x19cc3
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x719d(%rip), %rsi      # 0x20a44
movl $0x63, %edx
callq 0x66f0
movl $0x28be, 0x9c(%rbx,%r14) # imm = 0x28BE
jmp 0x19cc3
movl (%r14), %edx
cmpl $0x18, %edx
ja 0x19c65
movl $0x1100402, %eax        # imm = 0x1100402
btl %edx, %eax
jae 0x19c65
xorl %ebp, %ebp
movb $0x1, %al
testb %al, %al
je 0x19c1d
testq %rbx, %rbx
je 0x19968
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
addq (%rbx), %rcx
cmpq $0x3, %rcx
jb 0x19968
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x420093, %eax         # imm = 0x420093
jne 0x19968
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq *0x868(%rbx)
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x19c40
movq %rbx, %rdi
movl $0x420093, %esi         # imm = 0x420093
movq %rax, %rdx
callq 0x6cc0
testl %eax, %eax
je 0x19968
movl %eax, %ebp
leaq 0x84bc(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28cd, %edx           # imm = 0x28CD
jmp 0x19991
leaq 0x10(%r14), %r15
movq %rbx, %rdi
movl $0x42007f, %esi         # imm = 0x42007F
movq %r15, %rdx
callq 0x6ae0
testl %eax, %eax
je 0x1999b
movl %eax, %ebp
leaq 0x8491(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28d1, %edx           # imm = 0x28D1
callq 0x6de0
jmp 0x19cc3
movl (%r15), %r15d
xorl %ebp, %ebp
cmpl $0x4, %r15d
jb 0x199d4
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
movq %rbx, %rdi
movl $0x42007f, %esi         # imm = 0x42007F
movl %r15d, %edx
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
callq 0x6120
leaq 0x8453(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28d2, %edx           # imm = 0x28D2
callq 0x6de0
cmpl $0x4, %r15d
setae %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x19cc3
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
addq (%rbx), %rcx
cmpq $0x3, %rcx
jb 0x19a44
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x42007e, %eax         # imm = 0x42007E
jne 0x19a44
leaq 0x14(%r14), %rdx
movq %rbx, %rdi
movl $0x42007e, %esi         # imm = 0x42007E
callq 0x6ae0
testl %eax, %eax
je 0x19a44
movl %eax, %ebp
leaq 0x83e3(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28d7, %edx           # imm = 0x28D7
jmp 0x19991
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x19cc3
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
addq (%rbx), %rcx
cmpq $0x3, %rcx
jb 0x19ace
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x42007d, %eax         # imm = 0x42007D
jne 0x19ace
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq *0x868(%rbx)
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x19c71
movq %rbx, %rdi
movl $0x42007d, %esi         # imm = 0x42007D
movq %rax, %rdx
callq 0x6540
testl %eax, %eax
je 0x19ace
movl %eax, %r15d
leaq 0x8359(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28e0, %edx           # imm = 0x28E0
jmp 0x19b51
testq %rbx, %rbx
je 0x19cc3
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
addq (%rbx), %rcx
cmpq $0x3, %rcx
jb 0x19b5e
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x420006, %eax         # imm = 0x420006
jne 0x19b5e
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq *0x868(%rbx)
movq %rax, 0x20(%r14)
testq %rax, %rax
je 0x19c96
movq %rbx, %rdi
movl $0x420006, %esi         # imm = 0x420006
movq %rax, %rdx
callq 0x6cc0
testl %eax, %eax
je 0x19b5e
movl %eax, %r15d
leaq 0x82d1(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28e9, %edx           # imm = 0x28E9
callq 0x6de0
movl %r15d, %ebp
jmp 0x19cc3
testq %rbx, %rbx
je 0x19cc3
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
addq (%rbx), %rcx
cmpq $0x3, %rcx
jb 0x19cc3
movzbl (%rax), %ecx
shll $0x10, %ecx
movzbl 0x1(%rax), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %eax
orl %edx, %eax
cmpl $0x42007c, %eax         # imm = 0x42007C
jne 0x19cc3
movl (%r14), %eax
cmpl $0x13, %eax
jg 0x19cd0
cmpl $0x1, %eax
je 0x19d2a
cmpl $0xa, %eax
jne 0x19d0f
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x18, %edx
callq *0x868(%rbx)
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x19db1
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6550
jmp 0x19d8a
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x6e42(%rip), %rsi      # 0x20a44
movl $0x63, %edx
callq 0x66f0
movl $0x28c3, 0x9c(%rbx,%r14) # imm = 0x28C3
jmp 0x19cc3
movq %rbx, %rdi
movl $0x42005c, %esi         # imm = 0x42005C
movl %ebp, %ecx
callq 0x6120
leaq 0x81e7(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28c4, %edx           # imm = 0x28C4
jmp 0x19991
leaq 0x813c(%rip), %rdx      # 0x21d83
movl $0x10, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x81bf(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28ca, %edx           # imm = 0x28CA
jmp 0x19cb9
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
xorl %eax, %eax
jmp 0x198e0
leaq 0x81c2(%rip), %rdx      # 0x21e3a
movl $0x10, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x818e(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28dd, %edx           # imm = 0x28DD
jmp 0x19cb9
leaq 0x81b7(%rip), %rdx      # 0x21e54
movl $0x10, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x8169(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28e6, %edx           # imm = 0x28E6
callq 0x6de0
movl $0xfffffff4, %ebp       # imm = 0xFFFFFFF4
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x14, %eax
je 0x19d5b
cmpl $0x18, %eax
jne 0x19d0f
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x20, %edx
callq *0x868(%rbx)
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x19dd9
movq %rbx, %rdi
movq %rax, %rsi
callq 0x67e0
jmp 0x19d8a
leaq 0x8104(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x290b, %edx           # imm = 0x290B
callq 0x6de0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x19cc3
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x18, %edx
callq *0x868(%rbx)
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x19e01
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6c70
jmp 0x19d8a
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq *0x868(%rbx)
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x19e29
movq %rbx, %rdi
movq %rax, %rsi
callq 0x69b0
movl %eax, %r14d
testl %eax, %eax
je 0x19cc3
leaq 0x807e(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x290f, %edx           # imm = 0x290F
callq 0x6de0
movl %r14d, %ebp
jmp 0x19cc3
leaq 0x80e5(%rip), %rdx      # 0x21e9d
movl $0x18, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x804e(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28f9, %edx           # imm = 0x28F9
jmp 0x19cb9
leaq 0x80fb(%rip), %rdx      # 0x21edb
movl $0x20, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x8026(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x2906, %edx           # imm = 0x2906
jmp 0x19cb9
leaq 0x8075(%rip), %rdx      # 0x21e7d
movl $0x18, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x7ffe(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x28f3, %edx           # imm = 0x28F3
jmp 0x19cb9
leaq 0x808a(%rip), %rdx      # 0x21eba
movl $0x8, %esi
movq %rbx, %rdi
callq 0x6ba0
leaq 0x7fd6(%rip), %rsi      # 0x21e1a
movq %rbx, %rdi
movl $0x2900, %edx           # imm = 0x2900
jmp 0x19cb9