#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 */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char ler_simounao() {
  char resp;
  do {
    scanf("%[^\n]", &resp);
    getchar();
    if ((resp != 's') && (resp != 'S') && (resp != 'n') && (resp != 'N'))
      printf("Resposta invalida, digite novamente!\n");
  } while ((resp != 's') && (resp != 'S') && (resp != 'n') && (resp != 'N'));
  return resp;
}


x86 assembly (clang, -O0):
<ler_simounao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x73,%eax
je     118f <ler_simounao+0x5f>
movsbl -0x1(%rbp),%eax
cmp    $0x53,%eax
je     118f <ler_simounao+0x5f>
movsbl -0x1(%rbp),%eax
cmp    $0x6e,%eax
je     118f <ler_simounao+0x5f>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
je     118f <ler_simounao+0x5f>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <ler_simounao+0x64>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0x2(%rbp)
je     11d7 <ler_simounao+0xa7>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x53,%ecx
mov    %al,-0x2(%rbp)
je     11d7 <ler_simounao+0xa7>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x2(%rbp)
je     11d7 <ler_simounao+0xa7>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1138 <ler_simounao+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ler_simounao>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r14
lea    0x7(%rsp),%r12
lea    0xebb(%rip),%r15
movabs $0x2100000021,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
movzbl 0x7(%rsp),%eax
lea    -0x4e(%rax),%ecx
cmp    $0x25,%cl
ja     11a0 <ler_simounao+0x70>
movzbl %cl,%ecx
bt     %rcx,%rbx
jae    11a0 <ler_simounao+0x70>
lea    -0x4e(%rax),%ecx
cmp    $0x25,%cl
ja     1160 <ler_simounao+0x30>
movzbl %cl,%ecx
bt     %rcx,%rbx
jae    1160 <ler_simounao+0x30>
jmp    11af <ler_simounao+0x7f>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
movzbl 0x7(%rsp),%eax
jmp    1188 <ler_simounao+0x58>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.1 = [38 x i8] c"Resposta invalida, digite novamente!\0A\00"
define signext i8 @ler_simounao() {
%1 = alloca i8
br label %2
2: ; preds = %39, %0
%3 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = call i32 (...) @getchar()
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 115
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 83
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 110
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i8, i8* %1
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 78
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %16, %12, %8, %2
br label %23
23: ; preds = %22
%24 = load i8, i8* %1
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 115
br i1 %26, label %27, label %39
27: ; preds = %23
%28 = load i8, i8* %1
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 83
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i8, i8* %1
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 110
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i8, i8* %1
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 78
br label %39
39: ; preds = %35, %31, %27, %23
%40 = phi i1 [ false, %31 ], [ false, %27 ], [ false, %23 ], [ %38, %35 ]
br i1 %40, label %2, label %41
41: ; preds = %39
%42 = load i8, i8* %1
ret i8 %42
}

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\0A]\00"
@str = [37 x i8] c"Resposta invalida, digite novamente!\00"
define signext i8 @ler_simounao() {
%1 = alloca i8
br label %2
2: ; preds = %9, %0
%3 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = call i32 (...) @getchar()
%5 = load i8, i8* %1
switch i8 %5, label %6 [
i8 115, label %9
i8 110, label %9
i8 83, label %9
i8 78, label %9
]
6: ; preds = %2
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%8 = load i8, i8* %1
br label %9
9: ; preds = %2, %2, %2, %2, %6
%10 = phi i8 [ %5, %2 ], [ %5, %2 ], [ %5, %2 ], [ %5, %2 ], [ %8, %6 ]
switch i8 %10, label %2 [
i8 115, label %11
i8 110, label %11
i8 83, label %11
i8 78, label %11
]
11: ; preds = %9, %9, %9, %9
ret i8 %10
}