#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 ler_intervalo(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float questiona_impressao(int *numero, int *opcao) {
  float tempo;
  printf("\nUma resolucao foi encontrada!\n");
  printf("\nResolucao encontrada em %d movimentos\n", *numero);
  printf("\nHa dois modos para exibicao da mesma:\n");
  printf("\t1 - Exibicao pausada por tempo;\n");
  printf("\t2 - Exibicao direta.\n");
  printf("\t3 - Exibicao pausada por ENTER.\n");
  printf("\nDigite a sua escolha:\n");
  switch (ler_intervalo(1, 3)) {
  case 1:
    printf("\nEntao, agora digite o tempo digitado ");
    printf("(Lembrando que pode ser decimal):\n");
    scanf("%f", &tempo);
    *opcao = 1;
    break;
  case 2:
    printf("\nA exibicao direta foi selecionada\n");
    tempo = 0.0;
    *opcao = 2;
    break;
  case 3:
    printf("\nA exibicao pausada por ENTER foi selecionada\n");
    tempo = 999.99;
    *opcao = 3;
    break;
  }
  return tempo;
}


x86 assembly (clang, -O0):
<questiona_impressao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rcx
mov    (%rcx),%esi
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xedc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xef5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf10(%rip),%rdi
call   1040 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf23(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <ler_intervalo@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
sub    $0x1,%eax
je     11f5 <questiona_impressao+0xc5>
jmp    11d3 <questiona_impressao+0xa3>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1230 <questiona_impressao+0x100>
jmp    11e4 <questiona_impressao+0xb4>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     1255 <questiona_impressao+0x125>
jmp    127a <questiona_impressao+0x14a>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf19(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    127a <questiona_impressao+0x14a>
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    127a <questiona_impressao+0x14a>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  0xd95(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<questiona_impressao>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xf23(%rip),%rdi
call   1030 <puts@plt>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xf42(%rip),%rdi
call   1030 <puts@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1040 <ler_intervalo@plt>
cmp    $0x3,%eax
je     11fa <questiona_impressao+0xba>
cmp    $0x2,%eax
je     1217 <questiona_impressao+0xd7>
cmp    $0x1,%eax
jne    122d <questiona_impressao+0xed>
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movl   $0x1,(%r14)
movss  0x4(%rsp),%xmm0
jmp    122d <questiona_impressao+0xed>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x3,(%r14)
movss  0xdeb(%rip),%xmm0
jmp    122d <questiona_impressao+0xed>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x2,(%r14)
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\0AUma resolucao foi encontrada!\0A\00"
@.str.1 = [40 x i8] c"\0AResolucao encontrada em %d movimentos\0A\00"
@.str.2 = [40 x i8] c"\0AHa dois modos para exibicao da mesma:\0A\00"
@.str.3 = [34 x i8] c"\091 - Exibicao pausada por tempo;\0A\00"
@.str.4 = [23 x i8] c"\092 - Exibicao direta.\0A\00"
@.str.5 = [34 x i8] c"\093 - Exibicao pausada por ENTER.\0A\00"
@.str.6 = [24 x i8] c"\0ADigite a sua escolha:\0A\00"
@.str.7 = [39 x i8] c"\0AEntao, agora digite o tempo digitado \00"
@.str.8 = [35 x i8] c"(Lembrando que pode ser decimal):\0A\00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [36 x i8] c"\0AA exibicao direta foi selecionada\0A\00"
@.str.11 = [47 x i8] c"\0AA exibicao pausada por ENTER foi selecionada\0A\00"
define float @questiona_impressao(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca float
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @ler_intervalo(i32 1, i32 3)
switch i32 %15, label %27 [
i32 1, label %16
i32 2, label %21
i32 3, label %24
]
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %5)
%20 = load i32*, i32** %4
store i32 1, i32* %20
br label %27
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
store float 0.000000e+00, float* %5
%23 = load i32*, i32** %4
store i32 2, i32* %23
br label %27
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
store float 0x408F3FEB80000000, float* %5
%26 = load i32*, i32** %4
store i32 3, i32* %26
br label %27
27: ; preds = %2, %24, %21, %16
%28 = load float, float* %5
ret float %28
}

LLVM IR (-O2):
@.str.1 = [40 x i8] c"\0AResolucao encontrada em %d movimentos\0A\00"
@.str.7 = [39 x i8] c"\0AEntao, agora digite o tempo digitado \00"
@.str.9 = [3 x i8] c"%f\00"
@str = [31 x i8] c"\0AUma resolucao foi encontrada!\00"
@str.12 = [39 x i8] c"\0AHa dois modos para exibicao da mesma:\00"
@str.13 = [33 x i8] c"\091 - Exibicao pausada por tempo;\00"
@str.14 = [22 x i8] c"\092 - Exibicao direta.\00"
@str.15 = [33 x i8] c"\093 - Exibicao pausada por ENTER.\00"
@str.16 = [23 x i8] c"\0ADigite a sua escolha:\00"
@str.17 = [46 x i8] c"\0AA exibicao pausada por ENTER foi selecionada\00"
@str.18 = [35 x i8] c"\0AA exibicao direta foi selecionada\00"
@str.19 = [34 x i8] c"(Lembrando que pode ser decimal):\00"
define float @questiona_impressao(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.16, i64 0, i64 0))
%13 = tail call i32 @ler_intervalo(i32 1, i32 3)
switch i32 %13, label %23 [
i32 1, label %14
i32 2, label %19
i32 3, label %21
]
14: ; preds = %2
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.19, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %3)
store i32 1, i32* %1
%18 = load float, float* %3
br label %23
19: ; preds = %2
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.18, i64 0, i64 0))
store i32 2, i32* %1
br label %23
21: ; preds = %2
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.17, i64 0, i64 0))
store i32 3, i32* %1
br label %23
23: ; preds = %2, %21, %19, %14
%24 = phi float [ undef, %2 ], [ 0x408F3FEB80000000, %21 ], [ 0.000000e+00, %19 ], [ %18, %14 ]
ret float %24
}