// File: /workspace/github_c_makefile_star2_O1/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_text_string
int
kmip_decode_text_string(KMIP *ctx, enum tag t, TextString *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_TEXT_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;
    
    char *index = value->value;
    
    for(uint32 i = 0; i < length; i++)
    {
        kmip_decode_int8_be(ctx, (int8*)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 0x10dc4
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10e56
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10da6
jmp 0x10e7d
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 0x10e87
cmpb $0x7, %al
jne 0x10ed6
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 0x10f22
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10f8f
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10e3b
jmp 0x10e7d
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xf025(%rip), %rsi      # 0x1fe8c
movl $0x63, %edx
callq 0x66f0
movl $0x21a2, 0x9c(%rbx,%r14) # imm = 0x21A2
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x10f82
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10ea5
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10e8e
jmp 0x10ecc
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xefd6(%rip), %rsi      # 0x1fe8c
movl $0x63, %edx
callq 0x66f0
movl $0x21aa, 0x9c(%rbx,%r14) # imm = 0x21AA
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x10f82
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10ef4
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10edd
jmp 0x10f1b
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xef87(%rip), %rsi      # 0x1fe8c
movl $0x63, %edx
callq 0x66f0
movl $0x21aa, 0x9c(%rbx,%r14) # imm = 0x21AA
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jmp 0x10f82
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
movq %r15, 0x8(%r14)
testl %r15d, %r15d
je 0x10f5a
movq %rax, %rsi
leaq 0x1(%rsi), %r14
movq %rbx, %rdi
callq 0x67a0
movq %r14, %rsi
decl %r15d
jne 0x10f46
testl %r12d, %r12d
je 0x10f80
xorl %ebp, %ebp
leaq 0x7(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x67a0
cmpb $0x0, 0x7(%rsp)
jne 0x10fbb
incb %bpl
cmpb %r12b, %bpl
jb 0x10f66
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 0xeeec(%rip), %rsi      # 0x1fe8c
movl $0x63, %edx
callq 0x66f0
movl $0x21ae, 0x9c(%rbx,%r14) # imm = 0x21AE
jmp 0x10e7d
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10fde
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10fc7
jmp 0x10f82
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xee9d(%rip), %rsi      # 0x1fe8c
movl $0x63, %edx
callq 0x66f0
movl $0x21bc, 0x9c(%rbx,%r14) # imm = 0x21BC
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
jmp 0x10f82