#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 vlr_compra, a_pag, parc, desc, acres;
  int op_pag, n_parc;
  printf("\nQual o valor da compra\n-->");
  scanf("%f", &vlr_compra);
  printf("\nQual a opcao de pagamento\n\n1 - A Vista\n2 - A Prazo\n\n-->");
  scanf("%d", &op_pag);
  if (op_pag == 1) {
    desc = vlr_compra * 10 / 100;
    a_pag = vlr_compra - desc;
    printf("\nVoce ganhou um desconto de R$%.2f\nValor a pagar %.2f\n\n", desc,
           a_pag);
  } else {
    if (op_pag == 2) {
      printf("\nNumero de Parcelas (2 ou 3):\n\n-->");
      scanf("%d", &n_parc);
      if (n_parc == 2) {
        parc = vlr_compra / 2;
        printf("\nValor de cada parcela R$%.2f\n\n", parc);
      } else {
        if (n_parc == 3) {
          acres = vlr_compra * 10 / 100;
          a_pag = vlr_compra + acres;
          parc = a_pag / 3;
          printf("\nValor do acrecimo R$%.2f\nValor a Pagar R$%.2f\nValor de "
                 "cada parcela R$%.2f\n\n",
                 acres, a_pag, parc);
        } else {
          printf("\nNumero de Parcelas invalido\n\n");
        }
      }
    } else {
      printf("\nOpcao de pagamento invalida\n\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    11cb <main+0xab>
movss  0xe87(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0xe76(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
cmpl   $0x2,-0x1c(%rbp)
jne    12c4 <main+0x1a4>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x2,-0x20(%rbp)
jne    1231 <main+0x111>
movss  -0x8(%rbp),%xmm0
movss  0xe00(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xecf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12bf <main+0x19f>
cmpl   $0x3,-0x20(%rbp)
jne    12ac <main+0x18c>
movss  0xdc5(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0xdb4(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xd8b(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe26(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    12ba <main+0x19a>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bf <main+0x19f>
jmp    12d2 <main+0x1b2>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1b7>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
je     11c1 <main+0x91>
cmp    $0x1,%eax
jne    1212 <main+0xe2>
movss  0xc(%rsp),%xmm1
movss  0xe6a(%rip),%xmm0
mulss  %xmm1,%xmm0
divss  0xe62(%rip),%xmm0
subss  %xmm0,%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xeb6(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    1269 <main+0x139>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe92(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    $0x3,%eax
je     121b <main+0xeb>
cmp    $0x2,%eax
jne    125d <main+0x12d>
movss  0xc(%rsp),%xmm0
mulss  0xe0e(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeeb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1269 <main+0x139>
lea    0xefb(%rip),%rdi
jmp    1264 <main+0x134>
movss  0xc(%rsp),%xmm2
movss  0xdd7(%rip),%xmm0
mulss  %xmm2,%xmm0
divss  0xdcf(%rip),%xmm0
addss  %xmm0,%xmm2
cvtss2sd %xmm2,%xmm1
divss  0xdc3(%rip),%xmm2
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm2,%xmm2
lea    0xe72(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
jmp    1269 <main+0x139>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0AQual o valor da compra\0A-->\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [57 x i8] c"\0AQual a opcao de pagamento\0A\0A1 - A Vista\0A2 - A Prazo\0A\0A-->\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [56 x i8] c"\0AVoce ganhou um desconto de R$%.2f\0AValor a pagar %.2f\0A\0A\00"
@.str.5 = [35 x i8] c"\0ANumero de Parcelas (2 ou 3):\0A\0A-->\00"
@.str.6 = [32 x i8] c"\0AValor de cada parcela R$%.2f\0A\0A\00"
@.str.7 = [78 x i8] c"\0AValor do acrecimo R$%.2f\0AValor a Pagar R$%.2f\0AValor de cada parcela R$%.2f\0A\0A\00"
@.str.8 = [31 x i8] c"\0ANumero de Parcelas invalido\0A\0A\00"
@.str.9 = [31 x i8] c"\0AOpcao de pagamento invalida\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %27
15: ; preds = %0
%16 = load float, float* %2
%17 = fmul float %16, 1.000000e+01
%18 = fdiv float %17, 1.000000e+02
store float %18, float* %5
%19 = load float, float* %2
%20 = load float, float* %5
%21 = fsub float %19, %20
store float %21, float* %3
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), double %23, double %25)
br label %67
27: ; preds = %0
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 2
br i1 %29, label %30, label %64
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%33 = load i32, i32* %8
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %41
35: ; preds = %30
%36 = load float, float* %2
%37 = fdiv float %36, 2.000000e+00
store float %37, float* %4
%38 = load float, float* %4
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %39)
br label %63
41: ; preds = %30
%42 = load i32, i32* %8
%43 = icmp eq i32 %42, 3
br i1 %43, label %44, label %60
44: ; preds = %41
%45 = load float, float* %2
%46 = fmul float %45, 1.000000e+01
%47 = fdiv float %46, 1.000000e+02
store float %47, float* %6
%48 = load float, float* %2
%49 = load float, float* %6
%50 = fadd float %48, %49
store float %50, float* %3
%51 = load float, float* %3
%52 = fdiv float %51, 3.000000e+00
store float %52, float* %4
%53 = load float, float* %6
%54 = fpext float %53 to double
%55 = load float, float* %3
%56 = fpext float %55 to double
%57 = load float, float* %4
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.7, i64 0, i64 0), double %54, double %56, double %58)
br label %62
60: ; preds = %41
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %62
62: ; preds = %60, %44
br label %63
63: ; preds = %62, %35
br label %66
64: ; preds = %27
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %66
66: ; preds = %64, %63
br label %67
67: ; preds = %66, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0AQual o valor da compra\0A-->\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [57 x i8] c"\0AQual a opcao de pagamento\0A\0A1 - A Vista\0A2 - A Prazo\0A\0A-->\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [56 x i8] c"\0AVoce ganhou um desconto de R$%.2f\0AValor a pagar %.2f\0A\0A\00"
@.str.5 = [35 x i8] c"\0ANumero de Parcelas (2 ou 3):\0A\0A-->\00"
@.str.6 = [32 x i8] c"\0AValor de cada parcela R$%.2f\0A\0A\00"
@.str.7 = [78 x i8] c"\0AValor do acrecimo R$%.2f\0AValor a Pagar R$%.2f\0AValor de cada parcela R$%.2f\0A\0A\00"
@str = [30 x i8] c"\0AOpcao de pagamento invalida\0A\00"
@str.10 = [30 x i8] c"\0ANumero de Parcelas invalido\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %41 [
i32 1, label %12
i32 2, label %20
]
12: ; preds = %0
%13 = load float, float* %1
%14 = fmul float %13, 1.000000e+01
%15 = fdiv float %14, 1.000000e+02
%16 = fsub float %13, %15
%17 = fpext float %15 to double
%18 = fpext float %16 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), double %17, double %18)
br label %43
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
switch i32 %23, label %39 [
i32 2, label %24
i32 3, label %29
]
24: ; preds = %20
%25 = load float, float* %1
%26 = fmul float %25, 5.000000e-01
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %27)
br label %43
29: ; preds = %20
%30 = load float, float* %1
%31 = fmul float %30, 1.000000e+01
%32 = fdiv float %31, 1.000000e+02
%33 = fadd float %30, %32
%34 = fdiv float %33, 3.000000e+00
%35 = fpext float %32 to double
%36 = fpext float %33 to double
%37 = fpext float %34 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.7, i64 0, i64 0), double %35, double %36, double %37)
br label %43
39: ; preds = %20
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
br label %43
41: ; preds = %0
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %43
43: ; preds = %41, %29, %39, %24, %12
ret i32 0
}