// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/arm_sub_section.c
// Function: subtilis_arm_subsections_dump
void subtilis_arm_subsections_dump(subtilis_arm_subsections_t *sss,
				   subtilis_arm_section_t *arm_s)
{
	size_t i;
	size_t j;
	size_t ptr;
	subtilis_arm_ss_t *ss;
	subtilis_arm_op_t *op;
	subtilis_error_t err;

	subtilis_error_init(&err);

	printf("Combined must Save Int: ");
	subtilis_bitset_dump(&sss->int_save);
	printf("Combined Must Save Real: ");
	subtilis_bitset_dump(&sss->real_save);
	printf("\n");

	for (i = 0; i < sss->count; i++) {
		ss = &sss->sub_sections[i];
		printf("\nSubsection %zu:\n", i);
		printf("------------------------------\n");
		printf("Size %zu\n", ss->size);
		printf("Int Inputs: ");
		subtilis_bitset_dump(&ss->int_inputs);
		printf("\n");
		printf("Real Inputs: ");
		subtilis_bitset_dump(&ss->real_inputs);
		printf("\n");
		printf("Links: ");
		for (j = 0; j < ss->num_links; j++) {
			printf("\t%zu\n", ss->links[j].link);
			printf("\tInt Outputs: ");
			subtilis_bitset_dump(&ss->links[j].int_outputs);
			printf("\tReal Outputs: ");
			subtilis_bitset_dump(&ss->links[j].real_outputs);
			printf("\tMust Save Int: ");
			subtilis_bitset_dump(&ss->links[j].int_save);
			printf("\tMust Save Real: ");
			subtilis_bitset_dump(&ss->links[j].real_save);
			op = &arm_s->op_pool->ops[ss->links[j].op];
			printf("\tOP ptr %zu: ", ss->links[j].op);
			if (op->type == SUBTILIS_ARM_OP_LABEL)
				printf("label_%zu\n", op->op.label);
			else
				subtilis_arm_instr_dump(&op->op.instr);
			printf("\n");
		}
		printf("\n");
		printf("------------------------------\n");
		printf("\n");
		ptr = ss->start;
		while (ptr != SIZE_MAX) {
			op = &arm_s->op_pool->ops[ptr];
			if (op->type == SUBTILIS_ARM_OP_LABEL)
				printf("label_%zu\n", op->op.label);
			else
				subtilis_arm_instr_dump(&op->op.instr);
			if (ptr == ss->end)
				break;

			ptr = op->next;
		}
		printf("\n");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc28, %rsp            # imm = 0xC28
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1c(%rsp), %rdi
callq 0x14404
leaq 0x17c81(%rip), %rdi     # 0x76944
xorl %eax, %eax
callq 0x12110
leaq 0x30(%r14), %rdi
callq 0x5de90
leaq 0x17c83(%rip), %rdi     # 0x7695d
xorl %eax, %eax
callq 0x12110
leaq 0x48(%r14), %rdi
callq 0x5de90
movl $0xa, %edi
callq 0x12030
cmpq $0x0, 0x8(%r14)
je 0x5ef39
leaq 0x17d06(%rip), %r15     # 0x76a0c
movq $0x0, (%rsp)
xorl %esi, %esi
movq %r14, 0x8(%rsp)
movq (%r14), %r14
imulq $0x130, %rsi, %rbp      # imm = 0x130
leaq (%r14,%rbp), %r12
leaq 0x17c4d(%rip), %rdi     # 0x76977
movq %rsi, 0x10(%rsp)
xorl %eax, %eax
callq 0x12110
movq %r15, %rdi
callq 0x12080
leaq (%r14,%rbp), %r13
addq $0x18, %r13
movq -0x18(%r13), %rsi
leaq 0x17c38(%rip), %rdi     # 0x76989
xorl %eax, %eax
callq 0x12110
leaq 0x17c34(%rip), %rdi     # 0x76993
xorl %eax, %eax
callq 0x12110
movq %r13, %rdi
callq 0x5de90
movl $0xa, %edi
callq 0x12030
leaq 0x17c21(%rip), %rdi     # 0x769a0
xorl %eax, %eax
callq 0x12110
leaq (%r14,%rbp), %r13
addq $0x30, %r13
movq %r13, %rdi
callq 0x5de90
movl $0xa, %edi
callq 0x12030
leaq 0x17c07(%rip), %rdi     # 0x769ae
xorl %eax, %eax
callq 0x12110
cmpq $0x0, 0xf8(%r13)
je 0x5ee9e
addq (%rsp), %r14
xorl %ebp, %ebp
leaq 0x48(%r14), %r13
movq 0xa8(%r14), %rsi
leaq 0x17be2(%rip), %rdi     # 0x769b6
xorl %eax, %eax
callq 0x12110
leaq 0x17bda(%rip), %rdi     # 0x769bc
xorl %eax, %eax
callq 0x12110
movq %r13, %rdi
callq 0x5de90
leaq 0x17bd3(%rip), %rdi     # 0x769cb
xorl %eax, %eax
callq 0x12110
leaq 0x60(%r14), %rdi
callq 0x5de90
leaq 0x17bcc(%rip), %rdi     # 0x769db
xorl %eax, %eax
callq 0x12110
leaq 0x78(%r14), %rdi
callq 0x5de90
leaq 0x17bc6(%rip), %rdi     # 0x769ec
xorl %eax, %eax
callq 0x12110
leaq 0x90(%r14), %rdi
callq 0x5de90
movq 0x38(%rbx), %rax
movq (%rax), %r13
movq 0xb0(%r14), %rsi
imulq $0x68, %rsi, %r15
leaq 0x17bac(%rip), %rdi     # 0x769fe
xorl %eax, %eax
callq 0x12110
leaq (%r15,%r13), %rdi
addq $0x8, %rdi
cmpl $0x1, -0x8(%rdi)
jne 0x5ee7a
movq (%rdi), %rsi
leaq 0x178b7(%rip), %rdi     # 0x76728
xorl %eax, %eax
callq 0x12110
jmp 0x5ee7f
callq 0x5cb09
movl $0xa, %edi
callq 0x12030
incq %rbp
addq $0x70, %r14
cmpq 0x128(%r12), %rbp
jb 0x5edc2
movl $0xa, %edi
callq 0x12030
leaq 0x17b5d(%rip), %r15     # 0x76a0c
movq %r15, %rdi
callq 0x12080
movl $0xa, %edi
callq 0x12030
movq 0x8(%r12), %r14
cmpq $-0x1, %r14
je 0x5ef10
movq 0x38(%rbx), %rax
movq (%rax), %r13
imulq $0x68, %r14, %rbp
leaq 0x8(,%rbp), %rdi
addq %r13, %rdi
cmpl $0x1, -0x8(%rdi)
jne 0x5eefb
movq (%rdi), %rsi
leaq 0x17836(%rip), %rdi     # 0x76728
xorl %eax, %eax
callq 0x12110
jmp 0x5ef00
callq 0x5cb09
cmpq 0x10(%r12), %r14
je 0x5ef10
addq %rbp, %r13
movq 0x58(%r13), %r14
jmp 0x5eec6
movl $0xa, %edi
callq 0x12030
movq 0x10(%rsp), %rsi
incq %rsi
addq $0x130, (%rsp)          # imm = 0x130
movq 0x8(%rsp), %r14
cmpq 0x8(%r14), %rsi
jb 0x5ed15
addq $0xc28, %rsp            # imm = 0xC28
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop