#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 *, float);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  float p1, p2, p3, p4, total;
  int codigo, quantidade;
  p1 = 5.3;
  p2 = 6.0;
  p3 = 3.2;
  p4 = 2.5;
  scanf("%d%d", &codigo, &quantidade);
  if (codigo == 1) {
    total = p1 * quantidade;
  }
  if (codigo == 2) {
    total = p2 * quantidade;
  }
  if (codigo == 3) {
    total = p3 * quantidade;
  }
  if (codigo == 4) {
    total = p4 * quantidade;
  }
  if (quantidade >= 15 || total >= 40.0) {
    total = total - total * 0.15;
  }
  printf("R$ %.2f\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeb3(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1194 <main+0x74>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    11b1 <main+0x91>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jne    11ce <main+0xae>
movss  -0x10(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jne    11eb <main+0xcb>
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0xf,-0x20(%rbp)
jge    1210 <main+0xf0>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1252 <main+0x132>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdd7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xdc7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
xor    %edx,%edx
cmp    $0x2,%ecx
sete   %sil
mov    (%rsp),%eax
cmp    $0x3,%ecx
je     115b <main+0x3b>
mov    %sil,%dl
lea    0xeac(%rip),%rsi
movss  (%rsi,%rdx,4),%xmm1
jmp    1163 <main+0x43>
movss  0xead(%rip),%xmm1
cvtsi2ss %eax,%xmm0
cmp    $0x4,%ecx
jne    1174 <main+0x54>
movss  0xea0(%rip),%xmm1
mulss  %xmm1,%xmm0
cmp    $0xe,%eax
jg     1186 <main+0x66>
ucomiss 0xe94(%rip),%xmm0
jb     11a1 <main+0x81>
cvtss2sd %xmm0,%xmm0
movsd  0xe76(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [9 x i8] c"R$ %.2f\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
store float 0x4015333340000000, float* %2
store float 6.000000e+00, float* %3
store float 0x40099999A0000000, float* %4
store float 2.500000e+00, float* %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %8)
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load float, float* %2
%14 = load i32, i32* %8
%15 = sitofp i32 %14 to float
%16 = fmul float %13, %15
store float %16, float* %6
br label %17
17: ; preds = %12, %0
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load float, float* %3
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to float
%24 = fmul float %21, %23
store float %24, float* %6
br label %25
25: ; preds = %20, %17
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load float, float* %4
%30 = load i32, i32* %8
%31 = sitofp i32 %30 to float
%32 = fmul float %29, %31
store float %32, float* %6
br label %33
33: ; preds = %28, %25
%34 = load i32, i32* %7
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load float, float* %5
%38 = load i32, i32* %8
%39 = sitofp i32 %38 to float
%40 = fmul float %37, %39
store float %40, float* %6
br label %41
41: ; preds = %36, %33
%42 = load i32, i32* %8
%43 = icmp sge i32 %42, 15
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = load float, float* %6
%46 = fpext float %45 to double
%47 = fcmp oge double %46, 4.000000e+01
br i1 %47, label %48, label %56
48: ; preds = %44, %41
%49 = load float, float* %6
%50 = fpext float %49 to double
%51 = load float, float* %6
%52 = fpext float %51 to double
%53 = fneg double %52
%54 = call double @llvm.fmuladd.f64(double %53, double 1.500000e-01, double %50)
%55 = fptrunc double %54 to float
store float %55, float* %6
br label %56
56: ; preds = %48, %44
%57 = load float, float* %6
%58 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [9 x i8] c"R$ %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 1
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to float
%10 = fmul float %9, 0x4015333340000000
%11 = select i1 %7, float %10, float undef
%12 = icmp eq i32 %6, 2
%13 = fmul float %9, 6.000000e+00
%14 = select i1 %12, float %13, float %11
%15 = icmp eq i32 %6, 3
%16 = fmul float %9, 0x40099999A0000000
%17 = select i1 %15, float %16, float %14
%18 = icmp eq i32 %6, 4
%19 = fmul float %9, 2.500000e+00
%20 = select i1 %18, float %19, float %17
%21 = icmp slt i32 %8, 15
%22 = fcmp ult float %20, 4.000000e+01
%23 = select i1 %21, i1 %22, i1 false
br i1 %23, label %29, label %24
24: ; preds = %0
%25 = fpext float %20 to double
%26 = fneg double %25
%27 = call double @llvm.fmuladd.f64(double %26, double 1.500000e-01, double %25)
%28 = fptrunc double %27 to float
br label %29
29: ; preds = %0, %24
%30 = phi float [ %28, %24 ], [ %20, %0 ]
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float %30)
ret i32 0
}