// File: /workspace/github_c_makefile_star2_O1/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 0x3a9d
movzbl (%rax), %esi
testl %esi, %esi
je 0x3ab1
cmpb $0x0, 0x1(%rax)
jne 0x3ab1
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3aa6
movzbl (%rax), %edi
cmpl $0x2d, %edi
je 0x3a8f
movl $0x3, %ecx
movb $0x1, %dl
cmpl $0x2b, %edi
jne 0x3aad
cmpb $0x0, 0x1(%rax)
je 0x3b0a
cmpb $0x2d, %dil
jne 0x3aad
xorl %edx, %edx
cmpb $0x0, 0x1(%rax)
setne %dl
leal (%rdx,%rdx,2), %ecx
jmp 0x3aad
leaq 0xb675(%rip), %rsi      # 0xf119
jmp 0x3ab8
movl $0x2, %ecx
xorl %edx, %edx
testb %dl, %dl
je 0x3ace
leaq 0xb648(%rip), %rsi      # 0xf100
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0xb06f
movl %ebx, %edi
popq %rbx
jmp 0xbcdc
movb $0x1, %dil
xorl %edx, %edx
addl $-0x63, %esi
cmpl $0x15, %esi
ja 0x3b90
leaq 0xb51e(%rip), %r8       # 0xf004
movslq (%r8,%rsi,4), %rsi
addq %r8, %rsi
jmpq *%rsi
testq %rax, %rax
jne 0x3b7b
leaq 0x160b1(%rip), %rax     # 0x19bb0
xorl %ebx, %ebx
cmpq $0x0, (%rax)
setne %bl
jmp 0x3ac6
movl $0x1, %ecx
jmp 0x3aab
leaq 0x160d8(%rip), %rdx     # 0x19bf0
jmp 0x3b8e
testq %rax, %rax
jne 0x3b7b
leaq 0x1609e(%rip), %rdx     # 0x19bc4
jmp 0x3b8e
leaq 0x160ad(%rip), %rdx     # 0x19bdc
jmp 0x3b8e
leaq 0x1609c(%rip), %rdx     # 0x19bd4
jmp 0x3b8e
leaq 0x1608b(%rip), %rdx     # 0x19bcc
jmp 0x3b8e
testq %rax, %rax
jne 0x3b7b
leaq 0x16079(%rip), %rdx     # 0x19bc8
jmp 0x3b8e
testq %rax, %rax
jne 0x3b7b
leaq 0x16083(%rip), %rdx     # 0x19be0
jmp 0x3b8e
testq %rax, %rax
jne 0x3b7b
leaq 0x16079(%rip), %rdx     # 0x19be4
jmp 0x3b8e
leaq 0x16078(%rip), %rdx     # 0x19bec
jmp 0x3b8e
testq %rax, %rax
je 0x3b87
leaq 0xb5ca(%rip), %rsi      # 0xf14c
jmp 0x3ab8
leaq 0x1605a(%rip), %rdx     # 0x19be8
xorl %edi, %edi
testb %dil, %dil
je 0x3ba1
leaq 0xb59f(%rip), %rsi      # 0xf13b
jmp 0x3ab8
testq %rax, %rax
je 0x3bb2
movl %ecx, (%rdx)
movl $0x1, %ebx
jmp 0x3ac6
movl (%rdx), %ebx
jmp 0x3ac6