// File: /workspace/github_c_makefile_star2_O3/rakitzis[P]rc/builtins.c
// Function: b_flag
static void b_flag(char **av) {
	bool *flagp = NULL;
	char f;
	int mode = 3; /* 0 = reset (-), 1 = set (+), 2 = test */
	const char *usage = "usage: flag f [ + | - ]\n";

	if (*++av == NULL) {
		fprint(2, RC "not enough arguments to flag\n");
		set(FALSE);
		return;
	}
	f = av[0][0];
	if (f == '\0' || av[0][1] != '\0') goto flag_usage;
	if (*++av == NULL) {
		mode = 2;
	} else if (av[0][0] == '+' && av[0][1] == '\0') {
		mode = 1;
	} else if (av[0][0] == '-' && av[0][1] == '\0') {
		mode = 0;
	}
	if (mode == 3) goto flag_usage;
	switch (f) {
		case 'c':
			if (mode != 2) goto flag_immutable;
			set(dashsee[0] != NULL);
			return;
		case 'd':
			if (mode != 2) goto flag_immutable;
			flagp = &dashdee; break;
		case 'e': flagp = &dashee; break;
		case 'i': flagp = &interactive; break;
		case 'l':
			  if (mode != 2) goto flag_immutable;
			  flagp = &dashell; break;
		case 'n': flagp = &dashen; break;
		case 'o':
			  if (mode != 2) goto flag_immutable;
			  flagp = &dashoh; break;
		case 'p':
			  if (mode != 2) goto flag_immutable;
			  flagp = &dashpee; break;
		case 's':
			  if (mode != 2) goto flag_immutable;
			  flagp = &dashess; break;
		case 'v': flagp = &dashvee; break;
		case 'x': flagp = &dashex; break;
	}
	if (flagp != NULL) {
		if (mode == 2)
			set(*flagp);
		else {
			*flagp = mode;
			set(TRUE);
		}
	} else {
		fprint(2, RC "unknown flag");
		set(FALSE);
	}
	return;
flag_immutable:
	fprint(2, RC "flag immutable\n");
	set(FALSE);
	return;
flag_usage:
	fprint(2, usage);
	set(FALSE);
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x39f8
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x39ef
cmpb $0x0, 0x1(%rax)
je 0x3a15
leaq 0xb700(%rip), %rsi      # 0xf0f6
jmp 0x39ff
leaq 0xb710(%rip), %rsi      # 0xf10f
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0xaf8c
movl %ebx, %edi
popq %rbx
jmp 0xbbec
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3a38
movzbl (%rax), %edx
cmpl $0x2d, %edx
je 0x3a74
cmpl $0x2b, %edx
jne 0x39ef
cmpb $0x0, 0x1(%rax)
jne 0x39ef
movl $0x1, %edx
jmp 0x3a3d
movl $0x2, %edx
addl $-0x63, %ecx
cmpl $0x15, %ecx
ja 0x3b0a
leaq 0xb5b4(%rip), %rsi      # 0xf004
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
testq %rax, %rax
jne 0x3afe
leaq 0x16147(%rip), %rax     # 0x19bb0
xorl %ebx, %ebx
cmpq $0x0, (%rax)
setne %bl
jmp 0x3a0d
cmpb $0x0, 0x1(%rax)
jne 0x39ef
xorl %edx, %edx
jmp 0x3a3d
leaq 0x16167(%rip), %rcx     # 0x19bf0
jmp 0x3ae8
testq %rax, %rax
jne 0x3afe
leaq 0x1612d(%rip), %rcx     # 0x19bc4
jmp 0x3b1d
leaq 0x16139(%rip), %rcx     # 0x19bdc
jmp 0x3ae8
leaq 0x16128(%rip), %rcx     # 0x19bd4
jmp 0x3ae8
leaq 0x16117(%rip), %rcx     # 0x19bcc
jmp 0x3ae8
testq %rax, %rax
jne 0x3afe
leaq 0x16105(%rip), %rcx     # 0x19bc8
jmp 0x3b1d
testq %rax, %rax
jne 0x3afe
leaq 0x1610f(%rip), %rcx     # 0x19be0
jmp 0x3b1d
testq %rax, %rax
jne 0x3afe
leaq 0x16105(%rip), %rcx     # 0x19be4
jmp 0x3b1d
leaq 0x16104(%rip), %rcx     # 0x19bec
testq %rax, %rax
je 0x3b1d
movl %edx, (%rcx)
movl $0x1, %ebx
jmp 0x3a0d
testq %rax, %rax
je 0x3b16
leaq 0xb63d(%rip), %rsi      # 0xf142
jmp 0x39ff
leaq 0xb620(%rip), %rsi      # 0xf131
jmp 0x39ff
leaq 0x160cb(%rip), %rcx     # 0x19be8
movl (%rcx), %ebx
jmp 0x3a0d