// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/aerospike/as_string_builder.c
// Function: as_string_builder_append_bytes
bool
as_string_builder_append_bytes(as_string_builder* sb, uint8_t* src, uint32_t size)
{
	if (sb->resize) {
		// Ensure buffer is large enough to receive bytes.
		// min capacity = old length + 3 chars per byte including separator + 2 bracket chars
		// - 1 extra separator + 1 null byte.
		uint32_t min_capacity = sb->length + (size * 3) + 2;

		if (min_capacity > sb->capacity) {
			if (! as_sb_increase_capacity(sb, min_capacity)) {
				return false;
			}
		}

		char* trg = &sb->data[sb->length];
		*trg++ = '[';

		for (uint32_t i = 0; i < size; i++) {
			uint8_t b = src[i];
			*trg++ = as_hex_chars[(b >> 4) & 0xf];
			*trg++ = as_hex_chars[b & 0xf];
			*trg++ = ' ';
		}
		trg--; // truncate last separator
		*trg++ = ']';
		*trg = 0;
		sb->length = (int)(trg - sb->data);
	}
	else {
		if (! as_sb_append_char(sb, '[')) {
			return false;
		}

		for (uint32_t i = 0; i < size; i++) {
			if (! as_sb_append_byte(sb, src[i])) {
				return false;
			}
		}
		sb->length--; // truncate last separator

		if (! as_sb_append_char(sb, ']')) {
			return false;
		}
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x10(%rax)
je 0x16f36
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
imull $0x3, -0x1c(%rbp), %ecx
addl %ecx, %eax
addl $0x2, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x16e4b
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x16fc0
testb $0x1, %al
jne 0x16e49
movb $0x0, -0x1(%rbp)
jmp 0x16fb3
jmp 0x16e4b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x5b, (%rax)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x16ef8
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x2d(%rbp)
movzbl -0x2d(%rbp), %eax
sarl $0x4, %eax
andl $0xf, %eax
movslq %eax, %rcx
movq 0x19136(%rip), %rax     # 0x2ffd8
movb (%rax,%rcx), %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movzbl -0x2d(%rbp), %eax
andl $0xf, %eax
movslq %eax, %rcx
movq 0x19111(%rip), %rax     # 0x2ffd8
movb (%rax,%rcx), %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x20, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x16e79
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x5d, (%rax)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x16faf
movq -0x10(%rbp), %rdi
movl $0x5b, %esi
callq 0x170a0
testb $0x1, %al
jne 0x16f4e
movb $0x0, -0x1(%rbp)
jmp 0x16fb3
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x16f88
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl (%rax,%rcx), %esi
callq 0x17110
testb $0x1, %al
jne 0x16f7b
movb $0x0, -0x1(%rbp)
jmp 0x16fb3
jmp 0x16f7d
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x16f55
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movl $0x5d, %esi
callq 0x170a0
testb $0x1, %al
jne 0x16fad
movb $0x0, -0x1(%rbp)
jmp 0x16fb3
jmp 0x16faf
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop