// File: /workspace/github_c_makefile_star2_O3/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 0x10bc5
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10c57
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10ba7
jmp 0x10c7e
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 0x10c88
cmpb $0x8, %al
jne 0x10cd7
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 0x10d23
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10d90
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10c3c
jmp 0x10c7e
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe2fc(%rip), %rsi      # 0x1ef64
movl $0x63, %edx
callq 0x66f0
movl $0x21c5, 0x9c(%rbx,%r14) # imm = 0x21C5
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x10d83
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10ca6
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10c8f
jmp 0x10ccd
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe2ad(%rip), %rsi      # 0x1ef64
movl $0x63, %edx
callq 0x66f0
movl $0x21cd, 0x9c(%rbx,%r14) # imm = 0x21CD
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x10d83
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10cf5
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10cde
jmp 0x10d1c
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe25e(%rip), %rsi      # 0x1ef64
movl $0x63, %edx
callq 0x66f0
movl $0x21cd, 0x9c(%rbx,%r14) # imm = 0x21CD
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jmp 0x10d83
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
movq %r15, 0x8(%r14)
testl %r15d, %r15d
je 0x10d5b
movq %rax, %rsi
leaq 0x1(%rsi), %r14
movq %rbx, %rdi
callq 0x67a0
movq %r14, %rsi
decl %r15d
jne 0x10d47
testl %r12d, %r12d
je 0x10d81
xorl %ebp, %ebp
leaq 0x7(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x67a0
cmpb $0x0, 0x7(%rsp)
jne 0x10dbc
incb %bpl
cmpb %r12b, %bpl
jb 0x10d67
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 0xe1c3(%rip), %rsi      # 0x1ef64
movl $0x63, %edx
callq 0x66f0
movl $0x21d1, 0x9c(%rbx,%r14) # imm = 0x21D1
jmp 0x10c7e
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10ddf
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10dc8
jmp 0x10d83
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe174(%rip), %rsi      # 0x1ef64
movl $0x63, %edx
callq 0x66f0
movl $0x21df, 0x9c(%rbx,%r14) # imm = 0x21DF
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
jmp 0x10d83