#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char ler_resposta() {
  char resp;
  do {
    scanf("%c", &resp);
    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_resposta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x73,%eax
je     1178 <ler_resposta+0x58>
movsbl -0x1(%rbp),%eax
cmp    $0x53,%eax
je     1178 <ler_resposta+0x58>
movsbl -0x1(%rbp),%eax
cmp    $0x6e,%eax
je     1178 <ler_resposta+0x58>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
je     1178 <ler_resposta+0x58>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <ler_resposta+0x5d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0x2(%rbp)
je     11c0 <ler_resposta+0xa0>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x53,%ecx
mov    %al,-0x2(%rbp)
je     11c0 <ler_resposta+0xa0>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x2(%rbp)
je     11c0 <ler_resposta+0xa0>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1128 <ler_resposta+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ler_resposta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%r14
lea    0x7(%rsp),%r12
lea    0xec8(%rip),%r15
movabs $0x2100000021,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movzbl 0x7(%rsp),%eax
lea    -0x4e(%rax),%ecx
cmp    $0x25,%cl
ja     1190 <ler_resposta+0x70>
movzbl %cl,%ecx
bt     %rcx,%rbx
jae    1190 <ler_resposta+0x70>
lea    -0x4e(%rax),%ecx
cmp    $0x25,%cl
ja     1150 <ler_resposta+0x30>
movzbl %cl,%ecx
bt     %rcx,%rbx
jae    1150 <ler_resposta+0x30>
jmp    119f <ler_resposta+0x7f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
call   1030 <puts@plt>
movzbl 0x7(%rsp),%eax
jmp    1171 <ler_resposta+0x51>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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