// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_proc.c
// Function: output_verilog_sdiv
int output_verilog_sdiv(FILE *fp)
{
	PARSER_TREE_IR *now_parser_tree_ir = parser_tree_ir_top;
	int is_sdiv = 0;

    while(now_parser_tree_ir != NULL){
		if(now_parser_tree_ir->flag == PARSER_IR_FLAG_SCALL){
			is_sdiv = 1;
		}
        now_parser_tree_ir = now_parser_tree_ir->next_ptr;
	}

	if(!is_sdiv){
		return 0;
	}

	fprintf(fp, "// sdiv module;\n");
	fprintf(fp, "reg __call_sdiv_req;\n");
	fprintf(fp, "wire __call_sdiv_ready;\n");
	fprintf(fp, "wire __call_sdiv_done;\n");
	fprintf(fp, "reg [31:0] __call_sdiv_args_0;\n");
	fprintf(fp, "reg [31:0] __call_sdiv_args_1;\n");
	fprintf(fp, "wire [31:0] __call_sdiv_result;\n");

	fprintf(fp, "synverll_sdiv_32x32 u_synverll_sdiv_32x32(\n");
	fprintf(fp, "\t.system_clock(__func_clock),\n");
	fprintf(fp, "\t.system_reset(__func_reset),\n");

	fprintf(fp, "\t.__call_sdiv_req(__call_sdiv_req),\n");
	fprintf(fp, "\t.__call_sdiv_ready(__call_sdiv_ready),\n");
	fprintf(fp, "\t.__call_sdiv_done(__call_sdiv_done),\n");
	fprintf(fp, "\t.__call_sdiv_args_0(__call_sdiv_args_0),\n");
	fprintf(fp, "\t.__call_sdiv_args_1(__call_sdiv_args_1),\n");
	fprintf(fp, "\t.__call_sdiv_result(__call_sdiv_result)\n");

	fprintf(fp, ");\n\n");

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
leaq 0xbbc7(%rip), %rcx      # 0x13130
pushq $0x1
popq %rdx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x7581
cmpl $0x13, 0x10(%rcx)
cmovel %edx, %eax
addq $0x8, %rcx
jmp 0x756c
testl %eax, %eax
je 0x76fe
leaq 0x722d(%rip), %rdi      # 0xe7bd
pushq $0x10
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7225(%rip), %rdi      # 0xe7ce
pushq $0x15
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7226(%rip), %rdi      # 0xe7e4
pushq $0x18
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x722a(%rip), %rdi      # 0xe7fd
pushq $0x17
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x722d(%rip), %rdi      # 0xe815
pushq $0x1f
popq %r15
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7234(%rip), %rdi      # 0xe835
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x723f(%rip), %rdi      # 0xe855
pushq $0x20
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x724b(%rip), %rdi      # 0xe876
pushq $0x2b
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7262(%rip), %rdi      # 0xe8a2
pushq $0x1e
popq %r15
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7268(%rip), %rdi      # 0xe8c1
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7272(%rip), %rdi      # 0xe8e0
pushq $0x24
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7282(%rip), %rdi      # 0xe905
pushq $0x28
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x7296(%rip), %rdi      # 0xe92e
pushq $0x26
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x72a8(%rip), %rdi      # 0xe955
pushq $0x2a
popq %r15
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x72ba(%rip), %rdi      # 0xe980
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x72d0(%rip), %rdi      # 0xe9ab
pushq $0x29
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x66ff(%rip), %rdi      # 0xddef
pushq $0x4
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11c0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq