// File: /workspace/github_c_makefile_star2_O1/oridb[P]mc/mi/flatten.c
// Function: compare
static Node *
compare(Flattenctx *s, Node *n, int fields)
{
	const Op cmpmap[Numops][3] = {
		[Oeq] = {Oeq, Oueq, Ofeq},
		[One] = {One, Oune, Ofne},
		[Ogt] = {Ogt, Ougt, Ofgt},
		[Oge] = {Oge, Ouge, Ofge},
		[Olt] = {Olt, Oult, Oflt},
		[Ole] = {Ole, Oule, Ofle}
	};
	Node *r;
	Type *ty;
	Op newop;

	/* void is always void */
	if (tybase(exprtype(n->expr.args[0]))->type == Tyvoid)
		return mkboollit(n->loc, 1);

	newop = Obad;
	ty = tybase(exprtype(n->expr.args[0]));
	if (istysigned(ty))
		newop = cmpmap[n->expr.op][0];
	else if (istyunsigned(ty))
		newop = cmpmap[n->expr.op][1];
	else if (istyunsigned(ty))
		newop = cmpmap[n->expr.op][1];
	else if (ty->type == Typtr)
		newop = cmpmap[n->expr.op][1];
	else if (istyfloat(ty))
		newop = cmpmap[n->expr.op][2];

	if (newop != Obad) {
		n->expr.op = newop;
		r = visit(s, n);
	} else if (fields) {
		r = comparecomplex(s, n, exprop(n));
	} else {
		fatal(n, "unsupported comparison on type %s", tystr(ty));
	}
	r->expr.type = mktype(n->loc, Tybool);
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x50(%rsi), %rax
movq (%rax), %rdi
callq 0x1e5d4
movq %rax, %rdi
callq 0x22c44
cmpl $0x1, (%rax)
jne 0x2a6ad
movq (%rbx), %rdi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e46e
movq 0x50(%rbx), %rax
movq (%rax), %rdi
callq 0x1e5d4
movq %rax, %rdi
callq 0x22c44
movq %rax, %r15
movq %rax, %rdi
callq 0x23461
testl %eax, %eax
je 0x2a6e4
movl 0x18(%rbx), %eax
leaq (%rax,%rax,2), %rax
leaq 0xde92(%rip), %rcx      # 0x38570
leaq (%rcx,%rax,4), %rax
jmp 0x2a71c
movq %r15, %rdi
callq 0x23441
testl %eax, %eax
jne 0x2a706
movq %r15, %rdi
callq 0x23441
testl %eax, %eax
jne 0x2a706
cmpl $0x12, (%r15)
jne 0x2a844
movl 0x18(%rbx), %eax
leaq (%rax,%rax,2), %rax
leaq 0xde5c(%rip), %rcx      # 0x38570
leaq (%rcx,%rax,4), %rax
addq $0x4, %rax
movl (%rax), %eax
testl %eax, %eax
je 0x2a738
movl %eax, 0x18(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a8c4
movq %rax, %r14
jmp 0x2a825
testl %ebp, %ebp
je 0x2a88f
movq %rbx, %rdi
callq 0x1d672
movl %eax, %ebp
movq 0x50(%rbx), %rax
movq (%rax), %rdi
callq 0x1e5d4
movq %rax, %rdi
callq 0x22c44
cmpl $0x18, (%rax)
jne 0x2a872
movq %rax, %rdi
callq 0x22c7f
testl %eax, %eax
je 0x2a872
movq 0x50(%rbx), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x2974d
movq (%rbx), %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x1d832
movq %rax, %r15
movq 0x50(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x2974d
movq (%rbx), %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x1d832
movq %rax, %r14
movq (%rbx), %rdi
movl $0xd, %esi
callq 0x22d38
movq %rax, 0x20(%r15)
movq (%rbx), %rdi
movl $0xd, %esi
callq 0x22d38
movq %rax, 0x20(%r14)
movl $0x5a, %esi
cmpl $0x17, %ebp
je 0x2a7fe
cmpl $0x18, %ebp
jne 0x2a8ab
movl $0x5b, %esi
movq (%rbx), %rdi
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1d832
movq %rax, %r14
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x22d38
movq %rax, 0x20(%r14)
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x22d38
movq %rax, 0x20(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x234b0
testl %eax, %eax
je 0x2a86b
movl 0x18(%rbx), %eax
leaq (%rax,%rax,2), %rax
leaq 0xdd12(%rip), %rcx      # 0x38570
leaq (%rcx,%rax,4), %rax
addq $0x8, %rax
jmp 0x2a71c
xorl %eax, %eax
jmp 0x2a71e
movq 0x50(%rbx), %rax
movq (%rax), %rdi
callq 0x1e5d4
movq %rax, %rdi
callq 0x23e44
leaq 0xe2eb(%rip), %rsi      # 0x38b78
jmp 0x2a89e
movq %r15, %rdi
callq 0x23e44
leaq 0xe291(%rip), %rsi      # 0x38b2f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x13aa3
movl %ebp, %eax
leaq 0x35aec(%rip), %rcx     # 0x603a0
movq (%rcx,%rax,8), %rdx
leaq 0xe292(%rip), %rsi      # 0x38b51
movq %rbx, %rdi
jmp 0x2a8a4