// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/linearize.c
// Function: linearize_asm_statement
static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement *stmt)
{
	struct instruction *insn;
	struct expression *expr, *clob;
	struct asm_rules *rules;
	struct asm_operand *op;

	insn = alloc_instruction(OP_ASM, 0);
	expr = stmt->asm_string;
	if (!expr || expr->type != EXPR_STRING) {
		warning(stmt->pos, "expected string in inline asm");
		return VOID;
	}
	insn->string = expr->string->data;

	rules = __alloc_asm_rules(0);
	insn->asm_rules = rules;

	/* Gather the inputs.. */
	FOR_EACH_PTR(stmt->asm_inputs, op) {
		add_asm_input(ep, insn, op);
	} END_FOR_EACH_PTR(op);

	/* ... and the addresses for memory outputs */
	FOR_EACH_PTR(stmt->asm_outputs, op) {
		add_asm_output_address(ep, insn, op);
	} END_FOR_EACH_PTR(op);

	add_one_insn(ep, insn);

	/* Assign the outputs */
	FOR_EACH_PTR(stmt->asm_outputs, op) {
		add_asm_output(ep, insn, op);
	} END_FOR_EACH_PTR(op);

	/* and finally, look if it clobbers memory */
	FOR_EACH_PTR(stmt->asm_clobbers, clob) {
		if (!strcmp(clob->string->data, "memory"))
			insn->clobber_memory = 1;
	} END_FOR_EACH_PTR(clob);

	return VOID;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
pushq $0x4e
popq %rdi
xorl %esi, %esi
callq 0x1347f
movq %rax, %rbx
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x13763
cmpb $0x2, (%rax)
jne 0x13763
movq 0x28(%rax), %rax
addq $0x4, %rax
movq %rax, 0x30(%rbx)
xorl %edi, %edi
callq 0x12efd
movq %rax, 0x38(%rbx)
movq %r14, (%rsp)
movq 0x20(%r14), %r14
testq %r14, %r14
je 0x135d7
movq %r14, %r13
xorl %ebp, %ebp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jge 0x135ce
movq 0x18(%r13,%rbp,8), %r12
cmpw $0x100, %ax             # imm = 0x100
jb 0x135aa
testq %r12, %r12
je 0x135c9
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x13895
movq 0x38(%rbx), %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x14436
incq %rbp
jmp 0x1358d
movq 0x10(%r13), %r13
cmpq %r14, %r13
jne 0x1358b
movq (%rsp), %rax
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x13643
movq %r14, %r13
xorl %ebp, %ebp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jge 0x1363a
movq 0x18(%r13,%rbp,8), %r12
cmpw $0x100, %ax             # imm = 0x100
jb 0x13606
testq %r12, %r12
je 0x13635
testb $0x20, 0x18(%r12)
je 0x13635
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x13895
movq 0x38(%rbx), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x14436
orb $0x2, 0x40(%rbx)
incq %rbp
jmp 0x135e9
movq 0x10(%r13), %r13
cmpq %r14, %r13
jne 0x135e7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x13783
movq (%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x136f6
movq 0x8(%rsp), %r14
xorl %r12d, %r12d
movl (%r14), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0x136e7
movq 0x18(%r14,%r12,8), %r13
cmpw $0x100, %ax             # imm = 0x100
jb 0x13688
testq %r13, %r13
je 0x136e2
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
testb $0x20, 0x18(%r13)
jne 0x136e2
movq 0x10(%r13), %rsi
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x15d5d
testl %eax, %eax
je 0x136e2
movq %rbx, %rdi
callq 0x12c70
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
leaq 0x10(%rsp), %rdx
callq 0x14f94
movq 0x38(%rbx), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x14436
incq %r12
jmp 0x1366c
movq 0x10(%r14), %r14
cmpq 0x8(%rsp), %r14
jne 0x13669
movq (%rsp), %rax
movq 0x28(%rax), %r15
testq %r15, %r15
je 0x13754
leaq 0x2e1f5(%rip), %r14     # 0x418ff
movq %r15, %r12
xorl %r13d, %r13d
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jge 0x1374a
movq 0x18(%r12,%r13,8), %rcx
cmpw $0x100, %ax             # imm = 0x100
jb 0x1372d
testq %rcx, %rcx
je 0x13745
movq 0x28(%rcx), %rdi
addq $0x4, %rdi
movq %r14, %rsi
callq 0xe1c0
testl %eax, %eax
jne 0x13745
orb $0x1, 0x40(%rbx)
incq %r13
jmp 0x13710
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0x1370d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4(%r14), %rdi
leaq 0x2734b(%rip), %rsi     # 0x3aab9
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1108a