#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);
int /*<<< orphan*/ scanf(char *, char *);
int preguntar_respuesta(int numero) {
  char respuesta;
  do {
    printf("Quieres cambiar el dado %d [s, n]? ", numero);
    scanf(" %c", &respuesta);
  } while (respuesta != 's' && respuesta != 'n');
  if (respuesta == 's')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<preguntar_respuesta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0xa(%rbp)
je     1169 <preguntar_respuesta+0x49>
movsbl -0x9(%rbp),%eax
cmp    $0x6e,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    112b <preguntar_respuesta+0xb>
movsbl -0x9(%rbp),%eax
cmp    $0x73,%eax
jne    118d <preguntar_respuesta+0x6d>
movl   $0x1,-0x4(%rbp)
jmp    1194 <preguntar_respuesta+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<preguntar_respuesta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xecf(%rip),%r14
lea    0xeec(%rip),%r15
lea    0x7(%rsp),%r12
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x6e,%al
je     1169 <preguntar_respuesta+0x49>
cmp    $0x73,%al
jne    1140 <preguntar_respuesta+0x20>
mov    $0x1,%eax
jmp    116b <preguntar_respuesta+0x4b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Quieres cambiar el dado %d [s, n]? \00"
@.str.1 = [4 x i8] c" %c\00"
define i32 @preguntar_respuesta(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %9
9: ; preds = %5
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 115
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 110
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ false, %9 ], [ %16, %13 ]
br i1 %18, label %5, label %19
19: ; preds = %17
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 115
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 1, i32* %2
br label %25
24: ; preds = %19
store i32 0, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [36 x i8] c"Quieres cambiar el dado %d [s, n]? \00"
@.str.1 = [4 x i8] c" %c\00"
define i32 @preguntar_respuesta(i32 %0) {
%2 = alloca i8
br label %3
3: ; preds = %3, %1
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
switch i8 %6, label %3 [
i8 115, label %7
i8 110, label %8
]
7: ; preds = %3
br label %8
8: ; preds = %3, %7
%9 = phi i32 [ 1, %7 ], [ 0, %3 ]
ret i32 %9
}