#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() {
  printf("Indique o valor dos produtos da nfe que contenham ST\n");
  float ProdValue = 0;
  scanf("%f", &ProdValue);
  printf("O valor dos produtos é: %0.2f\n", ProdValue);
  printf("Informe se o MVA é fora ou dentro do estado\n");
  int MVA = 0;
  scanf("%d", &MVA);
  float ValorMVA = ProdValue * (MVA == 2 ? 1.0282f : 0.8592f);
  printf("O valor do MVA é %0.2f\n", ValorMVA);
  float ValorComMVA = ProdValue + ValorMVA;
  printf("O valor total é %0.2f\n", ValorComMVA);
  float ValorIcms = ValorComMVA * 0.29f;
  printf("O valor do ICMS é %0.2f\n", ValorIcms);
  float Diferenca = ValorMVA - ValorIcms;
  printf("O valor a recolher é %0.2f\n", Diferenca);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
lea    0xefd(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
lea    0xf10(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%eax
movss  0xe61(%rip),%xmm0
movss  0xe5d(%rip),%xmm1
movss  %xmm1,-0x20(%rbp)
cmp    $0x2,%eax
movss  %xmm0,-0x1c(%rbp)
je     11c8 <main+0xa8>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xde0(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf5f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0x8(%rsp)
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf55(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0x14(%rsp)
lea    0xea1(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
xor    %eax,%eax
cmpl   $0x2,0x14(%rsp)
sete   %al
lea    0xe4f(%rip),%rcx
mulss  (%rcx,%rax,4),%xmm0
movss  %xmm0,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe6b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
mulss  0xe08(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Indique o valor dos produtos da nfe que contenham ST\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"O valor dos produtos \C3\A9: %0.2f\0A\00"
@.str.3 = [46 x i8] c"Informe se o MVA \C3\A9 fora ou dentro do estado\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [25 x i8] c"O valor do MVA \C3\A9 %0.2f\0A\00"
@.str.6 = [24 x i8] c"O valor total \C3\A9 %0.2f\0A\00"
@.str.7 = [26 x i8] c"O valor do ICMS \C3\A9 %0.2f\0A\00"
@.str.8 = [29 x i8] c"O valor a recolher \C3\A9 %0.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%14 = load float, float* %1
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 2
%17 = zext i1 %16 to i64
%18 = select i1 %16, float 0x3FF07381E0000000, float 0x3FEB7E9100000000
%19 = fmul float %14, %18
store float %19, float* %3
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), double %21)
%23 = load float, float* %1
%24 = load float, float* %3
%25 = fadd float %23, %24
store float %25, float* %4
%26 = load float, float* %4
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %27)
%29 = load float, float* %4
%30 = fmul float %29, 0x3FD28F5C20000000
store float %30, float* %5
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double %32)
%34 = load float, float* %3
%35 = load float, float* %5
%36 = fsub float %34, %35
store float %36, float* %6
%37 = load float, float* %6
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %38)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"O valor dos produtos \C3\A9: %0.2f\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [25 x i8] c"O valor do MVA \C3\A9 %0.2f\0A\00"
@.str.6 = [24 x i8] c"O valor total \C3\A9 %0.2f\0A\00"
@.str.7 = [26 x i8] c"O valor do ICMS \C3\A9 %0.2f\0A\00"
@.str.8 = [29 x i8] c"O valor a recolher \C3\A9 %0.2f\0A\00"
@str = [53 x i8] c"Indique o valor dos produtos da nfe que contenham ST\00"
@str.9 = [45 x i8] c"Informe se o MVA \C3\A9 fora ou dentro do estado\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%6 = load float, float* %1
%7 = fpext float %6 to double
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.9, i64 0, i64 0))
%10 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%12 = load float, float* %1
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
%15 = select i1 %14, float 0x3FF07381E0000000, float 0x3FEB7E9100000000
%16 = fmul float %12, %15
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), double %17)
%19 = load float, float* %1
%20 = fadd float %19, %16
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %21)
%23 = fmul float %20, 0x3FD28F5C20000000
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double %24)
%26 = fsub float %16, %23
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %27)
ret i32 0
}