// File: /workspace/github_c_makefile_star2_O0/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
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 0x17127
movq -0x10(%rbp), %rdi
leaq 0xe24c(%rip), %rsi      # 0x2535d
movl $0x21a2, %edx           # imm = 0x21A2
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x172e9
jmp 0x17129
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 0x17178
movq -0x10(%rbp), %rdi
leaq 0xe1fb(%rip), %rsi      # 0x2535d
movl $0x21aa, %edx           # imm = 0x21AA
callq 0x6f20
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x172e9
movl -0x24(%rbp), %eax
andl $0xff, %eax
cmpl $0x7, %eax
je 0x171a6
movq -0x10(%rbp), %rdi
leaq 0xe1cd(%rip), %rsi      # 0x2535d
movl $0x21aa, %edx           # imm = 0x21AA
callq 0x6f20
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x172e9
jmp 0x171a8
jmp 0x171aa
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 0x17218
movq -0x10(%rbp), %rdi
leaq 0xe15b(%rip), %rsi      # 0x2535d
movl $0x21ae, %edx           # imm = 0x21AE
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x172e9
jmp 0x1721a
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 0x17290
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 0x17265
movb $0x0, -0x3d(%rbp)
movzbl -0x3d(%rbp), %eax
movzbl -0x29(%rbp), %ecx
cmpl %ecx, %eax
jge 0x172e2
movq -0x10(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0x6840
movsbl -0x2a(%rbp), %eax
cmpl $0x0, %eax
je 0x172d4
movq -0x10(%rbp), %rdi
leaq 0xe09c(%rip), %rsi      # 0x2535d
movl $0x21bc, %edx           # imm = 0x21BC
callq 0x6f20
movl $0xfffffff9, -0x4(%rbp) # imm = 0xFFFFFFF9
jmp 0x172e9
jmp 0x172d6
jmp 0x172d8
movb -0x3d(%rbp), %al
addb $0x1, %al
movb %al, -0x3d(%rbp)
jmp 0x17294
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)