#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *gettext(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
unsigned char ask_figure_or_letter(void) {
  char figure_or_letter = 'F';
  do {
    fprintf(stdout, gettext("Do you want to use figures or letters ? [F/l] "));
    figure_or_letter = fgetc(stdin);
  } while ((figure_or_letter != 'f') && (figure_or_letter != 'F') &&
           (figure_or_letter != 'l') && (figure_or_letter != 'L') &&
           (figure_or_letter != '\n'));
  return (((figure_or_letter == 'f') ||
           (figure_or_letter == 'F' || figure_or_letter == '\n'))
              ? 0
              : 1);
}


x86 assembly (clang, -O0):
<ask_figure_or_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x46,-0x1(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    0xeb1(%rip),%rdi
call   1030 <gettext@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rsi
call   1050 <fprintf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x66,%ecx
mov    %al,-0x9(%rbp)
je     11c5 <ask_figure_or_letter+0x95>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x46,%ecx
mov    %al,-0x9(%rbp)
je     11c5 <ask_figure_or_letter+0x95>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6c,%ecx
mov    %al,-0x9(%rbp)
je     11c5 <ask_figure_or_letter+0x95>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x4c,%ecx
mov    %al,-0x9(%rbp)
je     11c5 <ask_figure_or_letter+0x95>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113c <ask_figure_or_letter+0xc>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0xa(%rbp)
je     1207 <ask_figure_or_letter+0xd7>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x46,%ecx
mov    %al,-0xb(%rbp)
je     1201 <ask_figure_or_letter+0xd1>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_figure_or_letter>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e99(%rip),%r14
lea    0xf56(%rip),%r15
mov    0x2e9b(%rip),%r12
lea    0xeac(%rip),%rbx
jmp    1164 <ask_figure_or_letter+0x34>
cs nopw 0x0(%rax,%rax,1)
cmp    $0xa,%al
je     1196 <ask_figure_or_letter+0x66>
mov    (%r14),%ebp
mov    %r15,%rdi
call   1030 <gettext@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1050 <fprintf@plt>
mov    (%r12),%edi
call   1040 <fgetc@plt>
lea    -0x46(%rax),%ecx
cmp    $0x26,%cl
ja     1160 <ask_figure_or_letter+0x30>
movzbl %cl,%ecx
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
cmp    $0x46,%al
setne  %cl
cmp    $0xa,%al
setne  %al
and    %cl,%al
jmp    11a6 <ask_figure_or_letter+0x76>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [47 x i8] c"Do you want to use figures or letters ? [F/l] \00"
@stdin = global i32 0
define zeroext i8 @ask_figure_or_letter() {
%1 = alloca i8
store i8 70, i8* %1
br label %2
2: ; preds = %28, %0
%3 = load i32, i32* @stdout
%4 = call i8* @gettext(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fprintf(i32 %3, i8* %4)
%6 = load i32, i32* @stdin
%7 = call signext i8 @fgetc(i32 %6)
store i8 %7, i8* %1
br label %8
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 102
br i1 %11, label %12, label %28
12: ; preds = %8
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 70
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i8, i8* %1
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 108
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load i8, i8* %1
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 76
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8, i8* %1
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 10
br label %28
28: ; preds = %24, %20, %16, %12, %8
%29 = phi i1 [ false, %20 ], [ false, %16 ], [ false, %12 ], [ false, %8 ], [ %27, %24 ]
br i1 %29, label %2, label %30
30: ; preds = %28
%31 = load i8, i8* %1
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 102
br i1 %33, label %44, label %34
34: ; preds = %30
%35 = load i8, i8* %1
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 70
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* %1
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 10
br label %42
42: ; preds = %38, %34
%43 = phi i1 [ true, %34 ], [ %41, %38 ]
br label %44
44: ; preds = %42, %30
%45 = phi i1 [ true, %30 ], [ %43, %42 ]
%46 = zext i1 %45 to i64
%47 = select i1 %45, i32 0, i32 1
%48 = trunc i32 %47 to i8
ret i8 %48
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [47 x i8] c"Do you want to use figures or letters ? [F/l] \00"
@stdin = global i32 0
define zeroext i8 @ask_figure_or_letter() {
br label %1
1: ; preds = %1, %0
%2 = load i32, i32* @stdout
%3 = tail call i8* @gettext(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fprintf(i32 %2, i8* %3)
%5 = load i32, i32* @stdin
%6 = tail call signext i8 @fgetc(i32 %5)
switch i8 %6, label %1 [
i8 102, label %12
i8 10, label %7
i8 70, label %7
i8 76, label %7
i8 108, label %7
]
7: ; preds = %1, %1, %1, %1
%8 = icmp ne i8 %6, 70
%9 = icmp ne i8 %6, 10
%10 = and i1 %8, %9
%11 = zext i1 %10 to i8
br label %12
12: ; preds = %1, %7
%13 = phi i8 [ %11, %7 ], [ 0, %1 ]
ret i8 %13
}