// File: /workspace/github_c_makefile_star2_O0/saltyJeff[P]uClibcpp/extra/config/./confdata.c
// Function: conf_write
int conf_write(const char *name)
{
	FILE *out, *out_h;
	struct symbol *sym;
	struct menu *menu;
	const char *basename;
	char dirname[128], tmpname[128], newname[128];
	int type, l;
	const char *str;

	dirname[0] = 0;
	if (name && name[0]) {
		char *slash = strrchr(name, '/');
		if (slash) {
			int size = slash - name + 1;
			memcpy(dirname, name, size);
			dirname[size] = 0;
			if (slash[1])
				basename = slash + 1;
			else
				basename = conf_def_filename;
		} else
			basename = name;
	} else
		basename = conf_def_filename;

	sprintf(newname, "%s.tmpconfig.%d", dirname, getpid());
	out = fopen(newname, "w");
	if (!out)
		return 1;
	out_h = NULL;
	if (!name) {
		out_h = fopen(".tmpconfig.h", "w");
		if (!out_h)
			return 1;
	}
	fprintf(out, "#\n"
		     "# Automatically generated make config: don't edit\n"
		     "#\n");
	if (out_h)
		fprintf(out_h, "/*\n"
			     " * Automatically generated C config: don't edit\n"
			     " */\n"
			     "/*\n"
			     " * Version Number\n"
			     " */\n"
			     "#define __UCLIBCXX_MAJOR__ %s\n"
			     "#define __UCLIBCXX_MINOR__ %s\n"
			     "#define __UCLIBCXX_SUBLEVEL__ %s\n",
			     getenv("MAJOR_VERSION"),
			     getenv("MINOR_VERSION"),
			     getenv("SUBLEVEL"));

	if (!sym_change_count)
		sym_clear_all_valid();

	menu = rootmenu.list;
	while (menu) {
		sym = menu->sym;
		if (!sym) {
			if (!menu_is_visible(menu))
				goto next;
			str = menu_get_prompt(menu);
			fprintf(out, "\n"
				     "#\n"
				     "# %s\n"
				     "#\n", str);
			if (out_h)
				fprintf(out_h, "\n"
					       "/*\n"
					       " * %s\n"
					       " */\n", str);
		} else if (!(sym->flags & SYMBOL_CHOICE)) {
			sym_calc_value(sym);
			if (!(sym->flags & SYMBOL_WRITE))
				goto next;
			sym->flags &= ~SYMBOL_WRITE;
			type = sym->type;
			if (type == S_TRISTATE) {
				sym_calc_value(modules_sym);
				if (modules_sym->curr.tri == no)
					type = S_BOOLEAN;
			}
			switch (type) {
			case S_BOOLEAN:
			case S_TRISTATE:
				switch (sym_get_tristate_value(sym)) {
				case no:
					fprintf(out, "# %s is not set\n", sym->name);
					if (out_h)
						fprintf(out_h, "#undef __%s__\n", sym->name);
					break;
				case mod:
					fprintf(out, "%s=m\n", sym->name);
					if (out_h)
						fprintf(out_h, "#define %s_MODULE 1\n", sym->name);
					break;
				case yes:
					fprintf(out, "%s=y\n", sym->name);
					if (out_h)
						fprintf(out_h, "#define __%s__ 1\n", sym->name);
					break;
				}
				break;
			case S_STRING:
				// fix me
				str = sym_get_string_value(sym);
				fprintf(out, "%s=\"", sym->name);
				if (out_h)
					fprintf(out_h, "#define __%s__ \"", sym->name);
				do {
					l = strcspn(str, "\"\\");
					if (l) {
						fwrite(str, l, 1, out);
						if (out_h)
							fwrite(str, l, 1, out_h);
					}
					str += l;
					while (*str == '\\' || *str == '"') {
						fprintf(out, "\\%c", *str);
						if (out_h)
							fprintf(out_h, "\\%c", *str);
						str++;
					}
				} while (*str);
				fputs("\"\n", out);
				if (out_h)
					fputs("\"\n", out_h);
				break;
			case S_HEX:
				str = sym_get_string_value(sym);
				if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
					fprintf(out, "%s=%s\n", sym->name, str);
					if (out_h)
						fprintf(out_h, "#define __%s__ 0x%s\n", sym->name, str);
					break;
				}
			case S_INT:
				str = sym_get_string_value(sym);
				fprintf(out, "%s=%s\n", sym->name, str);
				if (out_h)
					fprintf(out_h, "#define __%s__ %s\n", sym->name, str);
				break;
			}
		}

	next:
		if (menu->list) {
			menu = menu->list;
			continue;
		}
		if (menu->next)
			menu = menu->next;
		else while ((menu = menu->parent)) {
			if (menu->next) {
				menu = menu->next;
				break;
			}
		}
	}
	fclose(out);
	if (out_h) {
		fclose(out_h);
		rename(".tmpconfig.h", "include/system_configuration.h");
		file_write_dep(NULL);
	}
	if (!name || basename != conf_def_filename) {
		if (!name)
			name = conf_def_filename;
		sprintf(tmpname, "%s.old", name);
		rename(name, tmpname);
	}
	sprintf(tmpname, "%s%s", dirname, basename);
	if (rename(newname, tmpname))
		return 1;

	sym_change_count = 0;

	return 0;
}

// Assembly:
subq $0x218, %rsp            # imm = 0x218
movq %rdi, 0x208(%rsp)
movb $0x0, 0x160(%rsp)
cmpq $0x0, 0x208(%rsp)
je 0xad89
movq 0x208(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xad89
movq 0x208(%rsp), %rdi
movl $0x2f, %esi
callq 0x2100
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0xad77
movq 0x48(%rsp), %rax
movq 0x208(%rsp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, 0x44(%rsp)
leaq 0x160(%rsp), %rdi
movq 0x208(%rsp), %rsi
movslq 0x44(%rsp), %rdx
callq 0x21e0
movslq 0x44(%rsp), %rax
movb $0x0, 0x160(%rsp,%rax)
movq 0x48(%rsp), %rax
cmpb $0x0, 0x1(%rax)
je 0xad66
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1e0(%rsp)
jmp 0xad75
leaq 0xa6c9(%rip), %rax      # 0x15436
movq %rax, 0x1e0(%rsp)
jmp 0xad87
movq 0x208(%rsp), %rax
movq %rax, 0x1e0(%rsp)
jmp 0xad98
leaq 0xa6a6(%rip), %rax      # 0x15436
movq %rax, 0x1e0(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x160(%rsp), %rax
movq %rax, 0x38(%rsp)
callq 0x20b0
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
movl %eax, %ecx
leaq 0xad04(%rip), %rsi      # 0x15acb
movb $0x0, %al
callq 0x22c0
leaq 0x60(%rsp), %rdi
leaq 0xb6e3(%rip), %rsi      # 0x164bd
callq 0x2270
movq %rax, 0x200(%rsp)
cmpq $0x0, 0x200(%rsp)
jne 0xae02
movl $0x1, 0x214(%rsp)
jmp 0xb5bd
movq $0x0, 0x1f8(%rsp)
cmpq $0x0, 0x208(%rsp)
jne 0xae51
leaq 0xacbb(%rip), %rdi      # 0x15adb
leaq 0xb696(%rip), %rsi      # 0x164bd
callq 0x2270
movq %rax, 0x1f8(%rsp)
cmpq $0x0, 0x1f8(%rsp)
jne 0xae4f
movl $0x1, 0x214(%rsp)
jmp 0xb5bd
jmp 0xae51
movq 0x200(%rsp), %rdi
leaq 0xac88(%rip), %rsi      # 0x15ae8
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xaecd
movq 0x1f8(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xad47(%rip), %rdi      # 0x15bcd
callq 0x2030
movq %rax, 0x20(%rsp)
leaq 0xad44(%rip), %rdi      # 0x15bdb
callq 0x2030
movq %rax, 0x28(%rsp)
leaq 0xad41(%rip), %rdi      # 0x15be9
callq 0x2030
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq %rax, %r8
leaq 0xac59(%rip), %rsi      # 0x15b1f
movb $0x0, %al
callq 0x21a0
cmpl $0x0, 0xee44(%rip)      # 0x19d18
jne 0xaedb
callq 0xb5d0
movq 0xe5e6(%rip), %rax      # 0x194c8
movq %rax, 0x1e8(%rsp)
cmpq $0x0, 0x1e8(%rsp)
je 0xb4b4
movq 0x1e8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x1f0(%rsp)
cmpq $0x0, 0x1f0(%rsp)
jne 0xaf86
movq 0x1e8(%rsp), %rdi
callq 0xb650
testb $0x1, %al
jne 0xaf2e
jmp 0xb421
movq 0x1e8(%rsp), %rdi
callq 0xb750
movq %rax, 0x50(%rsp)
movq 0x200(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0xac9e(%rip), %rsi      # 0x15bf2
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xaf81
movq 0x1f8(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0xac83(%rip), %rsi      # 0x15bfd
movb $0x0, %al
callq 0x21a0
jmp 0xb41f
movq 0x1f0(%rsp), %rax
movl 0x44(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xb41d
movq 0x1f0(%rsp), %rdi
callq 0xa4f0
movq 0x1f0(%rsp), %rax
movl 0x44(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0xafc4
jmp 0xb421
movq 0x1f0(%rsp), %rax
movl 0x44(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0x44(%rax)
movq 0x1f0(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x5c(%rsp)
cmpl $0x2, 0x5c(%rsp)
jne 0xb011
movq 0xe4bb(%rip), %rdi      # 0x194b0
callq 0xa4f0
movq 0xe4af(%rip), %rax      # 0x194b0
cmpl $0x0, 0x28(%rax)
jne 0xb00f
movl $0x1, 0x5c(%rsp)
jmp 0xb011
movl 0x5c(%rsp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x4, %eax
ja 0xb41b
movq 0x10(%rsp), %rax
leaq 0x55e9(%rip), %rcx      # 0x1061c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1f0(%rsp), %rdi
callq 0xb7b0
movl %eax, %ecx
movl %ecx, 0xc(%rsp)
testl %eax, %eax
je 0xb072
jmp 0xb055
movl 0xc(%rsp), %eax
subl $0x1, %eax
je 0xb0c6
jmp 0xb060
movl 0xc(%rsp), %eax
subl $0x2, %eax
je 0xb117
jmp 0xb168
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xab7f(%rip), %rsi      # 0x15c0c
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb0c1
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xab63(%rip), %rsi      # 0x15c1d
movb $0x0, %al
callq 0x21a0
jmp 0xb168
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xab4b(%rip), %rsi      # 0x15c2c
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb115
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xab24(%rip), %rsi      # 0x15c32
movb $0x0, %al
callq 0x21a0
jmp 0xb168
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xab15(%rip), %rsi      # 0x15c47
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb166
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xaaee(%rip), %rsi      # 0x15c4d
movb $0x0, %al
callq 0x21a0
jmp 0xb168
jmp 0xb41b
movq 0x1f0(%rsp), %rdi
callq 0xb7c0
movq %rax, 0x50(%rsp)
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xaac5(%rip), %rsi      # 0x15c5f
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb1ce
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0xaa9d(%rip), %rsi      # 0x15c64
movb $0x0, %al
callq 0x21a0
jmp 0xb1d0
movq 0x50(%rsp), %rdi
leaq 0xa8a6(%rip), %rsi      # 0x15a82
callq 0x2150
movl %eax, 0x58(%rsp)
cmpl $0x0, 0x58(%rsp)
je 0xb231
movq 0x50(%rsp), %rdi
movslq 0x58(%rsp), %rsi
movq 0x200(%rsp), %rcx
movl $0x1, %edx
callq 0x22e0
cmpq $0x0, 0x1f8(%rsp)
je 0xb22f
movq 0x50(%rsp), %rdi
movslq 0x58(%rsp), %rsi
movq 0x1f8(%rsp), %rcx
movl $0x1, %edx
callq 0x22e0
jmp 0xb231
movl 0x58(%rsp), %ecx
movq 0x50(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x5c, %ecx
movb %al, 0xb(%rsp)
je 0xb26a
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
sete %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0xb274
jmp 0xb2ce
movq 0x200(%rsp), %rdi
movq 0x50(%rsp), %rax
movsbl (%rax), %edx
leaq 0xa9ea(%rip), %rsi      # 0x15c75
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb2bb
movq 0x1f8(%rsp), %rdi
movq 0x50(%rsp), %rax
movsbl (%rax), %edx
leaq 0xa9c1(%rip), %rsi      # 0x15c75
movb $0x0, %al
callq 0x21a0
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0xb245
jmp 0xb2d0
movq 0x50(%rsp), %rax
cmpb $0x0, (%rax)
jne 0xb1d0
movq 0x200(%rsp), %rsi
leaq 0xa6ff(%rip), %rdi      # 0x159ec
callq 0x2110
cmpq $0x0, 0x1f8(%rsp)
je 0xb311
movq 0x1f8(%rsp), %rsi
leaq 0xa6e0(%rip), %rdi      # 0x159ec
callq 0x2110
jmp 0xb41b
movq 0x1f0(%rsp), %rdi
callq 0xb7c0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xb351
movq 0x50(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0xb3ac
movq 0x50(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
je 0xb3ac
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x50(%rsp), %rcx
leaq 0xa908(%rip), %rsi      # 0x15c79
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb3aa
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x50(%rsp), %rcx
leaq 0xa8dd(%rip), %rsi      # 0x15c80
movb $0x0, %al
callq 0x21a0
jmp 0xb41b
jmp 0xb3ae
movq 0x1f0(%rsp), %rdi
callq 0xb7c0
movq %rax, 0x50(%rsp)
movq 0x200(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x50(%rsp), %rcx
leaq 0xa899(%rip), %rsi      # 0x15c79
movb $0x0, %al
callq 0x21a0
cmpq $0x0, 0x1f8(%rsp)
je 0xb419
movq 0x1f8(%rsp), %rdi
movq 0x1f0(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x50(%rsp), %rcx
leaq 0xa883(%rip), %rsi      # 0x15c95
movb $0x0, %al
callq 0x21a0
jmp 0xb41b
jmp 0xb41d
jmp 0xb41f
jmp 0xb421
movq 0x1e8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xb449
movq 0x1e8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x1e8(%rsp)
jmp 0xaeea
movq 0x1e8(%rsp), %rax
cmpq $0x0, (%rax)
je 0xb46c
movq 0x1e8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1e8(%rsp)
jmp 0xb4af
jmp 0xb46e
movq 0x1e8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x1e8(%rsp)
cmpq $0x0, %rax
je 0xb4ad
movq 0x1e8(%rsp), %rax
cmpq $0x0, (%rax)
je 0xb4ab
movq 0x1e8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1e8(%rsp)
jmp 0xb4ad
jmp 0xb46e
jmp 0xb4af
jmp 0xaeea
movq 0x200(%rsp), %rdi
callq 0x20c0
cmpq $0x0, 0x1f8(%rsp)
je 0xb4f5
movq 0x1f8(%rsp), %rdi
callq 0x20c0
leaq 0xa5fb(%rip), %rdi      # 0x15adb
leaq 0xa7c1(%rip), %rsi      # 0x15ca8
callq 0x2280
xorl %eax, %eax
movl %eax, %edi
callq 0xb850
cmpq $0x0, 0x208(%rsp)
je 0xb511
leaq 0x9f2f(%rip), %rax      # 0x15436
cmpq %rax, 0x1e0(%rsp)
je 0xb55e
cmpq $0x0, 0x208(%rsp)
jne 0xb52b
leaq 0x9f13(%rip), %rax      # 0x15436
movq %rax, 0x208(%rsp)
leaq 0xe0(%rsp), %rdi
movq 0x208(%rsp), %rdx
leaq 0xa785(%rip), %rsi      # 0x15cc7
movb $0x0, %al
callq 0x22c0
movq 0x208(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x2280
leaq 0xe0(%rsp), %rdi
leaq 0x160(%rsp), %rdx
movq 0x1e0(%rsp), %rcx
leaq 0xa751(%rip), %rsi      # 0x15cce
movb $0x0, %al
callq 0x22c0
leaq 0x60(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x2280
cmpl $0x0, %eax
je 0xb5a8
movl $0x1, 0x214(%rsp)
jmp 0xb5bd
movl $0x0, 0xe766(%rip)      # 0x19d18
movl $0x0, 0x214(%rsp)
movl 0x214(%rsp), %eax
addq $0x218, %rsp            # imm = 0x218
retq
nopl (%rax)