// File: /workspace/github_c_makefile_star2_O1/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_byte_string
int
kmip_decode_byte_string(KMIP *ctx, enum tag t, ByteString *value)
{
    CHECK_BUFFER_FULL(ctx, 8);
    
    int32 tag_type = 0;
    uint32 length = 0;
    uint8 padding = 0;
    int8 spacer = 0;
    
    kmip_decode_int32_be(ctx, &tag_type);
    CHECK_TAG_TYPE(ctx, tag_type, t, KMIP_TYPE_BYTE_STRING);

    kmip_decode_length(ctx, &length);
    padding = CALCULATE_PADDING(length);
    CHECK_BUFFER_FULL(ctx, length + padding);
    
    value->value = ctx->calloc_func(ctx->state, 1, length);
    value->size = length;
    
    uint8 *index = value->value;
    
    for(uint32 i = 0; i < length; i++)
    {
        kmip_decode_int8_be(ctx, index++);
    }
    for(uint8 i = 0; i < padding; i++)
    {
        kmip_decode_int8_be(ctx, &spacer);
        CHECK_PADDING(ctx, spacer);
    }
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
addq (%rdi), %rax
cmpq $0x7, %rax
ja 0x11054
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x110e6
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x11036
jmp 0x1110d
movq %rdx, %r14
movl %esi, %ebp
xorl %eax, %eax
leaq 0xc(%rsp), %r15
movl %eax, (%r15)
movl %eax, 0x8(%rsp)
movb $0x0, 0x7(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6a10
movl (%r15), %eax
movl %eax, %ecx
sarl $0x8, %ecx
cmpl %ebp, %ecx
jne 0x11117
cmpb $0x8, %al
jne 0x11166
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64b0
movl (%r15), %r15d
movl %r15d, %r12d
negl %r12d
andl $0x7, %r12d
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
addq (%rbx), %rax
leal (%r12,%r15), %ecx
cmpq %rcx, %rax
jae 0x111b2
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x1121f
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x110cb
jmp 0x1110d
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xedf9(%rip), %rsi      # 0x1fef0
movl $0x63, %edx
callq 0x66f0
movl $0x21c5, 0x9c(%rbx,%r14) # imm = 0x21C5
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x11212
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x11135
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x1111e
jmp 0x1115c
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xedaa(%rip), %rsi      # 0x1fef0
movl $0x63, %edx
callq 0x66f0
movl $0x21cd, 0x9c(%rbx,%r14) # imm = 0x21CD
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x11212
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x11184
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x1116d
jmp 0x111ab
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xed5b(%rip), %rsi      # 0x1fef0
movl $0x63, %edx
callq 0x66f0
movl $0x21cd, 0x9c(%rbx,%r14) # imm = 0x21CD
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jmp 0x11212
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
movq %r15, 0x8(%r14)
testl %r15d, %r15d
je 0x111ea
movq %rax, %rsi
leaq 0x1(%rsi), %r14
movq %rbx, %rdi
callq 0x67a0
movq %r14, %rsi
decl %r15d
jne 0x111d6
testl %r12d, %r12d
je 0x11210
xorl %ebp, %ebp
leaq 0x7(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x67a0
cmpb $0x0, 0x7(%rsp)
jne 0x1124b
incb %bpl
cmpb %r12b, %bpl
jb 0x111f6
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xecc0(%rip), %rsi      # 0x1fef0
movl $0x63, %edx
callq 0x66f0
movl $0x21d1, 0x9c(%rbx,%r14) # imm = 0x21D1
jmp 0x1110d
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0x0, 0x64(%rdi,%r14)
je 0x1126e
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x11257
jmp 0x11212
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xec71(%rip), %rsi      # 0x1fef0
movl $0x63, %edx
callq 0x66f0
movl $0x21df, 0x9c(%rbx,%r14) # imm = 0x21DF
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
jmp 0x11212