// File: /workspace/github_c_makefile_star2_O3/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 0x10935
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x109c7
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10917
jmp 0x109ee
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 0x109f8
cmpb $0x7, %al
jne 0x10a47
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 0x10a93
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10b00
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x109ac
jmp 0x109ee
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe528(%rip), %rsi      # 0x1ef00
movl $0x63, %edx
callq 0x66f0
movl $0x21a2, 0x9c(%rbx,%r14) # imm = 0x21A2
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x10af3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10a16
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x109ff
jmp 0x10a3d
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe4d9(%rip), %rsi      # 0x1ef00
movl $0x63, %edx
callq 0x66f0
movl $0x21aa, 0x9c(%rbx,%r14) # imm = 0x21AA
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x10af3
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10a65
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10a4e
jmp 0x10a8c
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe48a(%rip), %rsi      # 0x1ef00
movl $0x63, %edx
callq 0x66f0
movl $0x21aa, 0x9c(%rbx,%r14) # imm = 0x21AA
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jmp 0x10af3
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
movq %r15, 0x8(%r14)
testl %r15d, %r15d
je 0x10acb
movq %rax, %rsi
leaq 0x1(%rsi), %r14
movq %rbx, %rdi
callq 0x67a0
movq %r14, %rsi
decl %r15d
jne 0x10ab7
testl %r12d, %r12d
je 0x10af1
xorl %ebp, %ebp
leaq 0x7(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x67a0
cmpb $0x0, 0x7(%rsp)
jne 0x10b2c
incb %bpl
cmpb %r12b, %bpl
jb 0x10ad7
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 0xe3ef(%rip), %rsi      # 0x1ef00
movl $0x63, %edx
callq 0x66f0
movl $0x21ae, 0x9c(%rbx,%r14) # imm = 0x21AE
jmp 0x109ee
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0x0, 0x64(%rdi,%r14)
je 0x10b4f
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0x10b38
jmp 0x10af3
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0xe3a0(%rip), %rsi      # 0x1ef00
movl $0x63, %edx
callq 0x66f0
movl $0x21bc, 0x9c(%rbx,%r14) # imm = 0x21BC
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
jmp 0x10af3