// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rdx), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq $0x8, %rax
jae 0x17357
movq -0x10(%rbp), %rdi
leaq 0xe034(%rip), %rsi      # 0x25375
movl $0x21c5, %edx           # imm = 0x21C5
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x17519
jmp 0x17359
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movb $0x0, -0x2a(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x6b10
movl -0x24(%rbp), %eax
sarl $0x8, %eax
cmpl -0x14(%rbp), %eax
je 0x173a8
movq -0x10(%rbp), %rdi
leaq 0xdfe3(%rip), %rsi      # 0x25375
movl $0x21cd, %edx           # imm = 0x21CD
callq 0x6f20
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x17519
movl -0x24(%rbp), %eax
andl $0xff, %eax
cmpl $0x8, %eax
je 0x173d6
movq -0x10(%rbp), %rdi
leaq 0xdfb5(%rip), %rsi      # 0x25375
movl $0x21cd, %edx           # imm = 0x21CD
callq 0x6f20
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x17519
jmp 0x173d8
jmp 0x173da
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x6520
movl -0x28(%rbp), %ecx
andl $0x7, %ecx
movl $0x8, %eax
subl %ecx, %eax
andl $0x7, %eax
movb %al, -0x29(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rdx), %rdx
subq %rdx, %rcx
subq %rcx, %rax
movl -0x28(%rbp), %ecx
movzbl -0x29(%rbp), %edx
addl %edx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x17448
movq -0x10(%rbp), %rdi
leaq 0xdf43(%rip), %rsi      # 0x25375
movl $0x21d1, %edx           # imm = 0x21D1
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x17519
jmp 0x1744a
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl -0x28(%rbp), %ecx
movl %ecx, %edx
movl $0x1, %esi
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x28(%rbp), %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x174c0
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
callq 0x6840
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x17495
movb $0x0, -0x3d(%rbp)
movzbl -0x3d(%rbp), %eax
movzbl -0x29(%rbp), %ecx
cmpl %ecx, %eax
jge 0x17512
movq -0x10(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0x6840
movsbl -0x2a(%rbp), %eax
cmpl $0x0, %eax
je 0x17504
movq -0x10(%rbp), %rdi
leaq 0xde84(%rip), %rsi      # 0x25375
movl $0x21df, %edx           # imm = 0x21DF
callq 0x6f20
movl $0xfffffff9, -0x4(%rbp) # imm = 0xFFFFFFF9
jmp 0x17519
jmp 0x17506
jmp 0x17508
movb -0x3d(%rbp), %al
addb $0x1, %al
movb %al, -0x3d(%rbp)
jmp 0x174c4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)