// File: /workspace/github_c_makefile_star2_O2/uhlin[P]enhanced-duc/source/settings.c
// Function: get_answer
char *
get_answer(const char *desc, enum setting_type type, const char *defaultAnswer)
{
	const size_t sz = 390;
	char *answer = xcalloc(sz, 1);

	log_assert_arg_nonnull("get_answer", "desc", desc);
	log_assert_arg_nonnull("get_answer", "defaultAnswer", defaultAnswer);

	(void) fputs(MAGENTA, stdout);
	(void) puts(desc);
	(void) fputs(NORMAL, stdout);

	(void) printf("Ans [%s]: ", defaultAnswer);
	(void) fflush(stdout);

	if (!strncmp(desc, "Your password.", 14))
		toggle_echo(OFF);
	const bool fgets_fail = fgets(answer, sz, stdin) == NULL;
	const int errno_save = errno;
	if (!strncmp(desc, "Your password.", 14)) {
		toggle_echo(ON);
		putchar('\n');
	}

	if (fgets_fail)
		fatal(errno_save, "get_answer: fatal: fgets fail");

	const bool input_too_big = strchr(answer, '\n') == NULL;
	int c = EOF;

	if (input_too_big) {
		fprintf(stderr, "%s get_answer: input too big!\n", GfxFailure);
		while (c = getchar(), c != '\n' && c != EOF)
			/* discard */;
		free(answer);
		return NULL;
	}

	/* trim newline */
	answer[strcspn(answer, "\n")] = '\0';

	if (strings_match(answer, "")) {
		free(answer);
		answer = xstrdup(defaultAnswer);
	}
	if (!is_setting_ok(answer, type)) {
		free(answer);
		return NULL;
	}
	return answer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
pushq $0x1
popq %rsi
movl $0x186, %edi            # imm = 0x186
callq 0x85a7
movq %rax, %rbx
leaq 0x322d(%rip), %r12      # 0xa6f1
leaq 0x3231(%rip), %rsi      # 0xa6fc
movq %r12, %rdi
movq %r15, %rdx
callq 0x7653
leaq 0x3224(%rip), %rsi      # 0xa701
movq %r12, %rdi
movq %r14, %rdx
callq 0x7653
movq 0x6a91(%rip), %r12      # 0xdf80
movq (%r12), %rsi
leaq 0x22c9(%rip), %rdi      # 0x97c3
callq 0x44f0
movq %r15, %rdi
callq 0x46c0
movq (%r12), %rsi
leaq 0x22b7(%rip), %rdi      # 0x97c9
callq 0x44f0
leaq 0x31f1(%rip), %rdi      # 0xa70f
movq %r14, %rsi
xorl %eax, %eax
callq 0x4060
movq (%r12), %rdi
callq 0x4510
leaq 0x31e2(%rip), %rsi      # 0xa71a
pushq $0xe
popq %rdx
movq %r15, %rdi
callq 0x41d0
testl %eax, %eax
jne 0x754f
pushq $0x1
popq %rdi
callq 0x83b8
movq 0x6a4a(%rip), %rax      # 0xdfa0
movq (%rax), %rdx
movq %rbx, %rdi
movl $0x186, %esi            # imm = 0x186
callq 0x46f0
movq %rax, %r13
callq 0x4050
movl (%rax), %r12d
leaq 0x31a2(%rip), %rsi      # 0xa71a
pushq $0xe
popq %rdx
movq %r15, %rdi
callq 0x41d0
testl %eax, %eax
jne 0x7596
xorl %edi, %edi
callq 0x83b8
pushq $0xa
popq %rdi
callq 0x4620
testq %r13, %r13
je 0x7642
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x4180
testq %rax, %rax
je 0x7612
leaq 0x2914(%rip), %rsi      # 0x9eca
movq %rbx, %rdi
callq 0x40a0
movb $0x0, (%rbx,%rax)
leaq 0x2902(%rip), %rsi      # 0x9ecb
movq %rbx, %rdi
callq 0x748d
testb %al, %al
je 0x75e8
movq %rbx, %rdi
callq 0x4530
movq %r14, %rdi
callq 0x851e
movq %rax, %rbx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7687
testb %al, %al
jne 0x7600
movq %rbx, %rdi
callq 0x4530
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x69a7(%rip), %rax      # 0xdfc0
movq (%rax), %rdi
leaq 0x3124(%rip), %rsi      # 0xa747
leaq 0x3546(%rip), %rdx      # 0xab70
xorl %eax, %eax
callq 0x4670
callq 0x4610
cmpl $-0x1, %eax
je 0x75f6
cmpl $0xa, %eax
jne 0x7631
jmp 0x75f6
leaq 0x30e0(%rip), %rsi      # 0xa729
movl %r12d, %edi
xorl %eax, %eax
callq 0x5513