// File: /workspace/github_c_makefile_star2_O2/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 0x399a
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x3991
cmpb $0x0, 0x1(%rax)
je 0x39b5
leaq 0xa75e(%rip), %rsi      # 0xe0f6
jmp 0x39a1
leaq 0xa76e(%rip), %rsi      # 0xe10f
xorl %ebx, %ebx
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0xa8f6
movl %ebx, %edi
popq %rbx
jmp 0xb43a
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x39d5
movzbl (%rax), %edx
cmpl $0x2d, %edx
je 0x3a0f
cmpl $0x2b, %edx
jne 0x3991
cmpb $0x0, 0x1(%rax)
jne 0x3991
pushq $0x1
jmp 0x39d7
pushq $0x2
popq %rdx
addl $-0x63, %ecx
cmpl $0x15, %ecx
ja 0x3aa0
leaq 0xa619(%rip), %rsi      # 0xe004
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
testq %rax, %rax
jne 0x3a94
leaq 0x161ac(%rip), %rax     # 0x19bb0
xorl %ebx, %ebx
cmpq $0x0, (%rax)
setne %bl
jmp 0x39ad
cmpb $0x0, 0x1(%rax)
jne 0x3991
xorl %edx, %edx
jmp 0x39d8
leaq 0x161cc(%rip), %rcx     # 0x19bf0
jmp 0x3a80
testq %rax, %rax
jne 0x3a94
leaq 0x16192(%rip), %rcx     # 0x19bc4
jmp 0x3ab3
leaq 0x161a1(%rip), %rcx     # 0x19bdc
jmp 0x3a80
leaq 0x16190(%rip), %rcx     # 0x19bd4
jmp 0x3a80
leaq 0x1617f(%rip), %rcx     # 0x19bcc
jmp 0x3a80
testq %rax, %rax
jne 0x3a94
leaq 0x1616d(%rip), %rcx     # 0x19bc8
jmp 0x3ab3
testq %rax, %rax
jne 0x3a94
leaq 0x16177(%rip), %rcx     # 0x19be0
jmp 0x3ab3
testq %rax, %rax
jne 0x3a94
leaq 0x1616d(%rip), %rcx     # 0x19be4
jmp 0x3ab3
leaq 0x1616c(%rip), %rcx     # 0x19bec
testq %rax, %rax
je 0x3ab3
movl %edx, (%rcx)
pushq $0x1
popq %rbx
jmp 0x39ad
testq %rax, %rax
je 0x3aac
leaq 0xa6a7(%rip), %rsi      # 0xe142
jmp 0x39a1
leaq 0xa68a(%rip), %rsi      # 0xe131
jmp 0x39a1
leaq 0x16135(%rip), %rcx     # 0x19be8
movl (%rcx), %ebx
jmp 0x39ad