short pede_confirma(msg)
char *msg;
{
  char R[128];
  while (1) {
    printf(msg);
    gets(R);
    eliminabr(R);
    Strupr(R);
    if ((*R == 'N') || (*R == 'S'))
      break;
    printf("\07");
  }
fim:
  return *R;
}


x86 assembly (clang, -O0):
<pede_confirma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1050 <gets@plt>
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1060 <eliminabr@plt>
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1040 <Strupr@plt>
movsbl -0x90(%rbp),%eax
cmp    $0x4e,%eax
je     11a4 <pede_confirma+0x64>
movsbl -0x90(%rbp),%eax
cmp    $0x53,%eax
jne    11a9 <pede_confirma+0x69>
jmp    11bc <pede_confirma+0x7c>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114f <pede_confirma+0xf>
jmp    11c1 <pede_confirma+0x81>
movsbl -0x90(%rbp),%eax
cwtl
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pede_confirma>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <gets@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <eliminabr@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <Strupr@plt>
movzbl (%rsp),%eax
cmp    $0x4e,%ax
je     11a2 <pede_confirma+0x52>
cmp    $0x53,%al
je     11a2 <pede_confirma+0x52>
mov    $0x7,%edi
call   1030 <putchar@plt>
jmp    1160 <pede_confirma+0x10>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\07\00"
define signext i16 @pede_confirma(i8* %0) {
%2 = alloca i8*
%3 = alloca [128 x i8]
store i8* %0, i8** %2
br label %4
4: ; preds = %1, %23
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* %5)
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @eliminabr to i32 (i8*, ...)*)(i8* %9)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @Strupr to i32 (i8*, ...)*)(i8* %11)
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 78
br i1 %16, label %22, label %17
17: ; preds = %4
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 83
br i1 %21, label %22, label %23
22: ; preds = %17, %4
br label %25
23: ; preds = %17
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %4
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i16
ret i16 %29
}

LLVM IR (-O2):
define signext i16 @pede_confirma(i8* nocapture %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %10, %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %3)
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @eliminabr to i32 (i8*, ...)*)(i8* %3)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @Strupr to i32 (i8*, ...)*)(i8* %3)
%9 = load i8, i8* %3
switch i8 %9, label %10 [
i8 83, label %12
i8 78, label %12
]
10: ; preds = %4
%11 = call i32 @putchar(i32 7)
br label %4
12: ; preds = %4, %4
%13 = zext i8 %9 to i16
ret i16 %13
}