#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 *, ...);
int main() {
  float valor;
  int estado;
  printf("Digite o valor do produto:");
  scanf("%f", &valor);
  printf("Digite o estado: \n 1 - Minas Gerais \n 2 - São Paulo \n 3 - Rio de "
         "Janeiro \n 4 - Mato Grosso \n Estado: ");
  scanf("%d", &estado);
  switch (estado) {
  case 1:
    printf("Preço final: R$ %.2f", valor + valor * 0.07);
    break;
  case 2:
    printf("Preço final: R$ %.2f", valor + valor * 0.12);
    break;
  case 3:
    printf("Preço final: R$ %.2f", valor + valor * 0.15);
    break;
  case 4:
    printf("Preço final: R$ %.2f", valor + valor * 0.08);
    break;
  default:
    printf("Estado inválido!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf01(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x19(%rbp),%al
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xf49(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1272 <main+0x152>
mov    -0x18(%rbp),%rax
lea    0xe8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe60(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xef1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe23(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xebc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xf07(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf60(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1190 <main+0x70>
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe8a(%rip),%xmm0
jmp    11d7 <main+0xb7>
lea    0xf37(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5f(%rip),%xmm0
jmp    11d7 <main+0xb7>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe44(%rip),%xmm0
jmp    11d7 <main+0xb7>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe29(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
lea    0xed2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite o valor do produto:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [103 x i8] c"Digite o estado: \0A 1 - Minas Gerais \0A 2 - S\C3\A3o Paulo \0A 3 - Rio de Janeiro \0A 4 - Mato Grosso \0A Estado: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [22 x i8] c"Pre\C3\A7o final: R$ %.2f\00"
@.str.5 = [18 x i8] c"Estado inv\C3\A1lido!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
switch i32 %8, label %37 [
i32 1, label %9
i32 2, label %16
i32 3, label %23
i32 4, label %30
]
9: ; preds = %0
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 7.000000e-02, double %11)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %14)
br label %39
16: ; preds = %0
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = call double @llvm.fmuladd.f64(double %20, double 1.200000e-01, double %18)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %21)
br label %39
23: ; preds = %0
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = load float, float* %2
%27 = fpext float %26 to double
%28 = call double @llvm.fmuladd.f64(double %27, double 1.500000e-01, double %25)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %28)
br label %39
30: ; preds = %0
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = load float, float* %2
%34 = fpext float %33 to double
%35 = call double @llvm.fmuladd.f64(double %34, double 8.000000e-02, double %32)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %35)
br label %39
37: ; preds = %0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %30, %23, %16, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Digite o valor do produto:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [103 x i8] c"Digite o estado: \0A 1 - Minas Gerais \0A 2 - S\C3\A3o Paulo \0A 3 - Rio de Janeiro \0A 4 - Mato Grosso \0A Estado: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [22 x i8] c"Pre\C3\A7o final: R$ %.2f\00"
@.str.5 = [18 x i8] c"Estado inv\C3\A1lido!\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %30 [
i32 1, label %10
i32 2, label %15
i32 3, label %20
i32 4, label %25
]
10: ; preds = %0
%11 = load float, float* %1
%12 = fpext float %11 to double
%13 = call double @llvm.fmuladd.f64(double %12, double 7.000000e-02, double %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %13)
br label %32
15: ; preds = %0
%16 = load float, float* %1
%17 = fpext float %16 to double
%18 = call double @llvm.fmuladd.f64(double %17, double 1.200000e-01, double %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %18)
br label %32
20: ; preds = %0
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = call double @llvm.fmuladd.f64(double %22, double 1.500000e-01, double %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %23)
br label %32
25: ; preds = %0
%26 = load float, float* %1
%27 = fpext float %26 to double
%28 = call double @llvm.fmuladd.f64(double %27, double 8.000000e-02, double %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %28)
br label %32
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %25, %20, %15, %10
ret i32 0
}