// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/target-riscv.c
// Function: parse_march_riscv
static void parse_march_riscv(const char *arg)
{
	static struct {
		const char *pattern;
		unsigned int flags;
	} basic_sets[] = {
		{ "rv32i",	RISCV_32BIT },
		{ "rv32e",	RISCV_32BIT|RISCV_EMBD },
		{ "rv32g",	RISCV_32BIT|RISCV_GENERIC },
		{ "rv64i",	RISCV_64BIT },
		{ "rv64g",	RISCV_64BIT|RISCV_GENERIC },
	}, extensions[] = {
		{ "m",		RISCV_MUL|RISCV_DIV },
		{ "a",		RISCV_ATOMIC },
		{ "f",		RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
		{ "d",		RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
		{ "c",		RISCV_COMP },
		{ "_zicsr",	RISCV_ZICSR },
		{ "_zifencei",	RISCV_ZIFENCEI },
		{ "_zicbom",	RISCV_ZICBOM },
		{ "_zihintpause",	RISCV_ZIHINTPAUSE },
	};
	int i;

	// Each -march=.. options entirely overrides previous ones
	riscv_flags = 0;

	for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
		const char *pat = basic_sets[i].pattern;
		size_t len = strlen(pat);

		if (!strncmp(arg, pat, len)) {
			riscv_flags |= basic_sets[i].flags;
			arg += len;
			goto ext;
		}
	}

unknown:
	fprintf(stderr, "WARNING: invalid argument to '-march': '%s'\n", arg);
	return;

ext:
	for (i = 0; i < ARRAY_SIZE(extensions); i++) {
		const char *pat = extensions[i].pattern;
		size_t len = strlen(pat);

		if (!strncmp(arg, pat, len)) {
			riscv_flags |= extensions[i].flags;
			arg += len;
		}
	}
	if (arg[0])
		goto unknown;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, 0x51242(%rip)     # 0x94378
movl $0x0, -0xc(%rbp)
movslq -0xc(%rbp), %rax
cmpq $0x5, %rax
jae 0x431c2
movslq -0xc(%rbp), %rcx
leaq 0x476ee(%rip), %rax     # 0x8a840
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x110c0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x11080
cmpl $0x0, %eax
jne 0x431b2
movslq -0xc(%rbp), %rcx
leaq 0x476b2(%rip), %rax     # 0x8a840
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
orl 0x511da(%rip), %eax     # 0x94378
movl %eax, 0x511d4(%rip)     # 0x94378
movq -0x20(%rbp), %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x431e5
jmp 0x431b4
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x4313d
jmp 0x431c4
movq 0x40e25(%rip), %rax     # 0x83ff0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x269d6(%rip), %rsi     # 0x69baf
movb $0x0, %al
callq 0x111c0
jmp 0x4327a
movl $0x0, -0xc(%rbp)
movslq -0xc(%rbp), %rax
cmpq $0x9, %rax
jae 0x4326c
movslq -0xc(%rbp), %rcx
leaq 0x4768f(%rip), %rax     # 0x8a890
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x110c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x11080
cmpl $0x0, %eax
jne 0x4325f
movslq -0xc(%rbp), %rcx
leaq 0x47653(%rip), %rax     # 0x8a890
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
orl 0x5112b(%rip), %eax     # 0x94378
movl %eax, 0x51125(%rip)     # 0x94378
movq -0x30(%rbp), %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x43261
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x431ec
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x4327a
jmp 0x431c4
addq $0x30, %rsp
popq %rbp
retq