// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/example.c
// Function: write_reg_to_storage
static void write_reg_to_storage(struct bb_state *state, struct hardreg *reg, pseudo_t pseudo, struct storage *storage)
{
	int i;
	struct hardreg *out;

	switch (storage->type) {
	case REG_REG:
		out = hardregs + storage->regno;
		if (reg == out)
			return;
		output_insn(state, "movl %s,%s", reg->name, out->name);
		return;
	case REG_UDEF:
		if (reg->busy < VERY_BUSY) {
			storage->type = REG_REG;
			storage->regno = reg - hardregs;
			reg->busy = REG_FIXED;
			return;
		}

		/* Try to find a non-busy register.. */
		for (i = 0; i < REGNO; i++) {
			out = hardregs + i;
			if (out->contains)
				continue;
			output_insn(state, "movl %s,%s", reg->name, out->name);
			storage->type = REG_REG;
			storage->regno = i;
			out->busy = REG_FIXED;
			return;
		}

		/* Fall back on stack allocation ... */
		alloc_stack(state, storage);
		/* Fall through */
	default:
		output_insn(state, "movl %s,%s", reg->name, show_memop(storage));
		return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
testl %eax, %eax
je 0x163da
jmp 0x16377
movl -0x34(%rbp), %eax
subl $0x1, %eax
jne 0x164d5
jmp 0x16385
movq -0x20(%rbp), %rax
movslq 0x10(%rax), %rcx
leaq 0x76e0c(%rip), %rax     # 0x8d1a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x163ae
jmp 0x16511
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rcx
leaq 0x52f52(%rip), %rsi     # 0x69319
leaq 0x53339(%rip), %r8      # 0x69707
movb $0x0, %al
callq 0x135a0
jmp 0x16511
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x3e8, %eax            # imm = 0x3E8
jge 0x16433
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
leaq 0x76d9e(%rip), %rcx     # 0x8d1a0
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl $0x7d0, %ecx            # imm = 0x7D0
movl %ecx, 0x10(%rax)
jmp 0x16511
movl $0x0, -0x24(%rbp)
cmpl $0x6, -0x24(%rbp)
jge 0x164c8
movslq -0x24(%rbp), %rcx
leaq 0x76d51(%rip), %rax     # 0x8d1a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x16467
jmp 0x164ba
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rcx
leaq 0x52e99(%rip), %rsi     # 0x69319
leaq 0x53280(%rip), %r8      # 0x69707
movb $0x0, %al
callq 0x135a0
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl $0x7d0, %ecx            # imm = 0x7D0
movl %ecx, 0x10(%rax)
jmp 0x16511
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1643a
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x14290
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x142d0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rdx
movq %rax, %rcx
leaq 0x52e16(%rip), %rsi     # 0x69319
leaq 0x531fd(%rip), %r8      # 0x69707
movb $0x0, %al
callq 0x135a0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)