// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/common/type.c
// Function: prv_init_copy_rec
static void prv_init_copy_rec(subtilis_type_rec_t *dst,
			      const subtilis_type_rec_t *src,
			      subtilis_error_t *err)
{
	size_t i;

	dst->alignment = src->alignment;
	dst->num_fields = 0;
	dst->fields = NULL;
	dst->field_types = NULL;

	dst->name = malloc(strlen(src->name) + 1);
	if (!dst->name) {
		subtilis_error_set_oom(err);
		return;
	}
	strcpy(dst->name, src->name);
	dst->max_fields = src->max_fields;
	dst->field_types = malloc(src->max_fields * sizeof(*dst->field_types));
	if (!dst->field_types) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}
	dst->fields = malloc(src->max_fields * sizeof(*dst->fields));
	if (!dst->fields) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}
	for (i = 0; i < src->num_fields; i++) {
		dst->fields[dst->num_fields].name =
		    malloc(strlen(src->fields[dst->num_fields].name) + 1);
		if (!dst->fields[dst->num_fields].name) {
			subtilis_error_set_oom(err);
			goto cleanup;
		}
		strcpy(dst->fields[dst->num_fields].name,
		       src->fields[dst->num_fields].name);
		dst->fields[dst->num_fields].size =
		    src->fields[dst->num_fields].size;
		dst->fields[dst->num_fields].alignment =
		    src->fields[dst->num_fields].alignment;
		dst->fields[dst->num_fields].vec_dim =
		    src->fields[dst->num_fields].vec_dim;
		subtilis_type_init_copy(&dst->field_types[dst->num_fields],
					&src->field_types[dst->num_fields],
					err);
		if (err->type != SUBTILIS_ERROR_OK) {
			free(dst->fields[dst->num_fields].name);
			goto cleanup;
		}
		dst->num_fields++;
	}

	return;

cleanup:
	prv_rec_type_free(dst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl (%rsi), %eax
movl %eax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq $0x0, 0x20(%rdi)
movq 0x8(%rsi), %rdi
callq 0x120f0
leaq 0x1(%rax), %rdi
callq 0x121d0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x2fa10
movq 0x8(%r12), %rsi
movq %rax, %rdi
callq 0x12070
movq 0x28(%r12), %r14
movq %r14, 0x28(%rbx)
imulq $0x148, %r14, %rdi      # imm = 0x148
callq 0x121d0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x2fa37
shlq $0x3, %r14
leaq (%r14,%r14,2), %rdi
callq 0x121d0
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x2fa4d
cmpq $0x0, 0x20(%r12)
je 0x2fa01
leaq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r15, 0x8(%rsp)
movq %rbx, (%rsp)
movq %rbx, %r15
movq %r12, %rbx
movq 0x18(%r12), %r12
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r14
movq (%r12,%r14), %rdi
callq 0x120f0
leaq 0x1(%rax), %rdi
callq 0x121d0
movq 0x18(%r15), %r15
movq %rax, (%r15,%r14)
testq %rax, %rax
je 0x2fa7c
leaq (%r12,%r14), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x12070
movq 0x8(%r12,%r14), %rax
movq %rax, 0x8(%r15,%r14)
movl 0x10(%r12,%r14), %eax
movl %eax, 0x10(%r15,%r14)
imulq $0x148, %rbp, %rsi      # imm = 0x148
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rsi, %rdi
addq 0x10(%rbx), %rsi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x2f457
cmpl $0x0, (%r15)
jne 0x2fa9d
movq %rbx, %r12
movq (%rsp), %rbx
movq 0x20(%rbx), %rbp
incq %rbp
movq %rbp, 0x20(%rbx)
incq %r13
cmpq 0x20(%r12), %r13
jb 0x2f957
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x456b1(%rip), %rdx     # 0x750c8
movq %r15, %rdi
movl $0x1, %esi
movl $0x1ef, %ecx            # imm = 0x1EF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x145a4
leaq 0x4568a(%rip), %rdx     # 0x750c8
movq %r15, %rdi
movl $0x1, %esi
movl $0x1f6, %ecx            # imm = 0x1F6
jmp 0x2fa61
leaq 0x45674(%rip), %rdx     # 0x750c8
movq %r15, %rdi
movl $0x1, %esi
movl $0x1fb, %ecx            # imm = 0x1FB
callq 0x145a4
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f71c
leaq 0x45645(%rip), %rdx     # 0x750c8
movq 0x8(%rsp), %rdi
movl $0x1, %esi
movl $0x202, %ecx            # imm = 0x202
callq 0x145a4
movq (%rsp), %rbx
jmp 0x2fa66
movq (%rsp), %rbx
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x122c0
jmp 0x2fa66