// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rsi, %r15
movq %rdi, %r14
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(%r14)
testq %rax, %rax
je 0x2fce4
movq 0x8(%r15), %rsi
movq %rax, %rdi
callq 0x12070
movq 0x28(%r15), %rax
movq %rax, 0x28(%r14)
movq 0x28(%r15), %rbx
imulq $0x148, %rbx, %rdi      # imm = 0x148
callq 0x121d0
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x2fd0b
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rdi
callq 0x121d0
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x2fd21
cmpq $0x0, 0x20(%r15)
je 0x2fcd5
leaq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
movq %r12, 0x8(%rsp)
movq %r14, (%rsp)
movq 0x18(%r15), %r12
movq 0x20(%r14), %rbp
leaq (,%rbp,8), %rax
movq %r14, %rbx
leaq (%rax,%rax,2), %r14
movq (%r12,%r14), %rdi
callq 0x120f0
leaq 0x1(%rax), %rdi
callq 0x121d0
movq 0x18(%rbx), %rbx
movq %rax, (%rbx,%r14)
testq %rax, %rax
je 0x2fd50
leaq (%r12,%r14), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x12070
movl 0xc(%r12,%r14), %eax
movl %eax, 0xc(%rbx,%r14)
movl 0x8(%r12,%r14), %eax
movl %eax, 0x8(%rbx,%r14)
movl 0x10(%r12,%r14), %eax
movl %eax, 0x10(%rbx,%r14)
imulq $0x148, %rbp, %rsi      # imm = 0x148
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rsi, %rdi
addq 0x10(%r15), %rsi
movq 0x8(%rsp), %r12
movq %r12, %rdx
callq 0x2f72e
cmpl $0x0, (%r12)
jne 0x2fd71
movq (%rsp), %r14
incq 0x20(%r14)
incq %r13
cmpq 0x20(%r15), %r13
jb 0x2fc2b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x453bd(%rip), %rdx     # 0x750a8
movq %r12, %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 0x145f4
leaq 0x45396(%rip), %rdx     # 0x750a8
movq %r12, %rdi
movl $0x1, %esi
movl $0x1f6, %ecx            # imm = 0x1F6
jmp 0x2fd35
leaq 0x45380(%rip), %rdx     # 0x750a8
movq %r12, %rdi
movl $0x1, %esi
movl $0x1fb, %ecx            # imm = 0x1FB
callq 0x145f4
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f9f1
leaq 0x45351(%rip), %rdx     # 0x750a8
movq 0x8(%rsp), %rdi
movl $0x1, %esi
movl $0x202, %ecx            # imm = 0x202
callq 0x145f4
movq (%rsp), %r14
jmp 0x2fd3a
movq (%rsp), %r14
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x122c0
jmp 0x2fd3a