#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 *, float *);
int /*<<< orphan*/ system(char *);
int main() {
  float x;
  printf("Digite o valor de x: ");
  scanf("%f", &x);
  if (x <= 1) {
    printf("O valor de f(x) é igual a 1.\n");
  } else if ((x > 1) && (x <= 2)) {
    printf("O valor de f(x) é igual a 2.\n");
  } else if ((x > 2) && (x <= 3)) {
    printf("O valor de f(x) é igual a %.2f.\n", (x * x));
  } else {
    printf("O valor de f(x) é igual a %.2f.\n", (x * x * x));
  }
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  0xe9b(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1182 <main+0x52>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1231 <main+0x101>
movss  -0x8(%rbp),%xmm0
movss  0xe71(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11bd <main+0x8d>
movss  0xe64(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11bd <main+0x8d>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122c <main+0xfc>
movss  -0x8(%rbp),%xmm0
movss  0xe3a(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1206 <main+0xd6>
movss  0xe2d(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1206 <main+0xd6>
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1227 <main+0xf7>
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    122c <main+0xfc>
jmp    1231 <main+0x101>
lea    0xe4d(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xe92(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    1197 <main+0x57>
ucomiss 0xe86(%rip),%xmm0
jbe    11a5 <main+0x65>
movss  0xe80(%rip),%xmm1
ucomiss %xmm0,%xmm1
jb     11a5 <main+0x65>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
jmp    11e1 <main+0xa1>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
jmp    11e1 <main+0xa1>
ucomiss 0xe58(%rip),%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
jbe    11cb <main+0x8b>
movss  0xe4b(%rip),%xmm2
ucomiss %xmm0,%xmm2
jb     11cb <main+0x8b>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jmp    11d3 <main+0x93>
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Digite o valor de x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [31 x i8] c"O valor de f(x) \C3\A9 igual a 1.\0A\00"
@.str.3 = [31 x i8] c"O valor de f(x) \C3\A9 igual a 2.\0A\00"
@.str.4 = [34 x i8] c"O valor de f(x) \C3\A9 igual a %.2f.\0A\00"
@.str.5 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load float, float* %2
%6 = fcmp ole float %5, 1.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %39
9: ; preds = %0
%10 = load float, float* %2
%11 = fcmp ogt float %10, 1.000000e+00
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load float, float* %2
%14 = fcmp ole float %13, 2.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %38
17: ; preds = %12, %9
%18 = load float, float* %2
%19 = fcmp ogt float %18, 2.000000e+00
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load float, float* %2
%22 = fcmp ole float %21, 3.000000e+00
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load float, float* %2
%25 = load float, float* %2
%26 = fmul float %24, %25
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %27)
br label %37
29: ; preds = %20, %17
%30 = load float, float* %2
%31 = load float, float* %2
%32 = fmul float %30, %31
%33 = load float, float* %2
%34 = fmul float %32, %33
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %35)
br label %37
37: ; preds = %29, %23
br label %38
38: ; preds = %37, %15
br label %39
39: ; preds = %38, %7
%40 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Digite o valor de x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.4 = [34 x i8] c"O valor de f(x) \C3\A9 igual a %.2f.\0A\00"
@.str.5 = [6 x i8] c"pause\00"
@str = [30 x i8] c"O valor de f(x) \C3\A9 igual a 2.\00"
@str.6 = [30 x i8] c"O valor de f(x) \C3\A9 igual a 1.\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp ugt float %5, 1.000000e+00
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
br label %27
9: ; preds = %0
%10 = fcmp ogt float %5, 1.000000e+00
%11 = fcmp ole float %5, 2.000000e+00
%12 = and i1 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %27
15: ; preds = %9
%16 = fcmp ogt float %5, 2.000000e+00
%17 = fcmp ole float %5, 3.000000e+00
%18 = and i1 %16, %17
%19 = fmul float %5, %5
br i1 %18, label %20, label %23
20: ; preds = %15
%21 = fpext float %19 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %21)
br label %27
23: ; preds = %15
%24 = fmul float %5, %19
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %25)
br label %27
27: ; preds = %13, %23, %20, %7
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}