// File: /workspace/github_c_makefile_star2_O1/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
xorl %edi, %edi
callq 0x302dd
movq %rax, %rbx
movl $0x80, %eax
andl (%rbx), %eax
orl $0x4e, %eax
movl %eax, (%rbx)
movq 0x53cba(%rip), %rax     # 0x67d68
movq %rax, 0x10(%rbx)
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x1432d
cmpb $0x2, (%rax)
jne 0x1432d
movq 0x28(%rax), %rax
addq $0x4, %rax
movq %rax, 0x30(%rbx)
leaq 0x4d10d(%rip), %rdi     # 0x611e8
movl $0x18, %esi
callq 0x2fd3c
movq %rax, 0x38(%rbx)
movq %r14, (%rsp)
movq 0x20(%r14), %r14
testq %r14, %r14
je 0x14150
movq %r14, %r13
movzwl (%r13), %eax
testb %al, %al
jle 0x14147
xorl %ebp, %ebp
movq 0x18(%r13,%rbp,8), %r12
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x14118
testq %r12, %r12
je 0x14137
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1447d
movq 0x38(%rbx), %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x1475a
incq %rbp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x14104
movq 0x10(%r13), %r13
cmpq %r14, %r13
jne 0x140f9
movq (%rsp), %rax
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x141c7
movq %r14, %r13
movzwl (%r13), %eax
testb %al, %al
jle 0x141be
xorl %ebp, %ebp
movq 0x18(%r13,%rbp,8), %r12
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x1417f
testq %r12, %r12
je 0x141ae
testb $0x20, 0x18(%r12)
je 0x141ae
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1447d
movq 0x38(%rbx), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x1475a
orb $0x2, 0x40(%rbx)
incq %rbp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x1416b
movq 0x10(%r13), %r13
cmpq %r14, %r13
jne 0x14160
movq 0x20(%r15), %rdi
testq %rdi, %rdi
je 0x141e0
movq %rdi, 0x8(%rbx)
addq $0x28, %rdi
movq %rbx, %rsi
callq 0x2285b
movq (%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x142b5
movq 0x8(%rsp), %r14
movzwl (%r14), %eax
testb %al, %al
jle 0x142a6
xorl %r12d, %r12d
movq 0x18(%r14,%r12,8), %r13
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x1421e
testq %r13, %r13
je 0x14293
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
testb $0x20, 0x18(%r13)
jne 0x14293
movq 0x10(%r13), %rsi
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x17aba
testl %eax, %eax
je 0x14293
xorl %edi, %edi
callq 0x303a3
movq %rax, %rbp
movl $0x3, 0x4(%rax)
movl 0x538f2(%rip), %eax     # 0x67b50
incl %eax
movl %eax, 0x538ea(%rip)     # 0x67b50
movl %eax, (%rbp)
movq %rbx, 0x18(%rbp)
movq %r15, %rdi
movq %rbp, %rsi
leaq 0x10(%rsp), %rdx
callq 0x16877
movq 0x38(%rbx), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x1475a
incq %r12
movl (%r14), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0x1420a
movq 0x10(%r14), %r14
cmpq 0x8(%rsp), %r14
jne 0x141fb
movq (%rsp), %rax
movq 0x28(%rax), %r15
testq %r15, %r15
je 0x1431e
leaq 0x35516(%rip), %r14     # 0x497df
movq %r15, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x14314
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rcx
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x142ec
testq %rcx, %rcx
je 0x14304
movq 0x28(%rcx), %rdi
addq $0x4, %rdi
movq %r14, %rsi
callq 0xe1c0
testl %eax, %eax
jne 0x14304
orb $0x1, 0x40(%rbx)
incq %r13
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0x142d8
movq 0x10(%r12), %r12
cmpq %r15, %r12
jne 0x142cc
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4(%r14), %rdi
leaq 0x2e751(%rip), %rsi     # 0x42a89
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x118b4