#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 *, double);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  double sum = 0, cPrice, price;
  int user, n, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %lf", &user, &price);
    cPrice = (user >= 20)
                 ? price * user * 80.0 / 100
                 : ((user / 2) * 2) * price * 90.0 / 100 + (user % 2) * price;
    sum += cPrice;
    printf("%.2f\n", cPrice);
  }
  printf("%.2f", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1234 <main+0x114>
lea    0xeb8(%rip),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x14,-0x24(%rbp)
jl     11ac <main+0x8c>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11fc <main+0xdc>
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xe3d(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe29(%rip),%xmm0
divsd  %xmm0,%xmm1
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe01(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1150 <main+0x30>
movsd  -0x10(%rbp),%xmm0
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xee5(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1205 <main+0xe5>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xec0(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0xeb6(%rip),%rbx
xor    %ebp,%ebp
jmp    11cd <main+0xad>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  0xe6d(%rip),%xmm1
divsd  0xe6d(%rip),%xmm1
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    120f <main+0xef>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x14,%eax
jl     1170 <main+0x50>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
mulsd  0xe15(%rip),%xmm0
divsd  0xe05(%rip),%xmm0
jmp    11ac <main+0x8c>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe12(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%d %lf\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
@.str.3 = [5 x i8] c"%.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %9
9: ; preds = %45, %0
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %48
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %5, double* %4)
%15 = load i32, i32* %5
%16 = icmp sge i32 %15, 20
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load double, double* %4
%19 = load i32, i32* %5
%20 = sitofp i32 %19 to double
%21 = fmul double %18, %20
%22 = fmul double %21, 8.000000e+01
%23 = fdiv double %22, 1.000000e+02
br label %38
24: ; preds = %13
%25 = load i32, i32* %5
%26 = sdiv i32 %25, 2
%27 = mul nsw i32 %26, 2
%28 = sitofp i32 %27 to double
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = fmul double %30, 9.000000e+01
%32 = fdiv double %31, 1.000000e+02
%33 = load i32, i32* %5
%34 = srem i32 %33, 2
%35 = sitofp i32 %34 to double
%36 = load double, double* %4
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double %32)
br label %38
38: ; preds = %24, %17
%39 = phi double [ %23, %17 ], [ %37, %24 ]
store double %39, double* %3
%40 = load double, double* %3
%41 = load double, double* %2
%42 = fadd double %41, %40
store double %42, double* %2
%43 = load double, double* %3
%44 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %43)
br label %45
45: ; preds = %38
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %9
48: ; preds = %9
%49 = load double, double* %2
%50 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%d %lf\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
@.str.3 = [5 x i8] c"%.2f\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = bitcast double* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %40
10: ; preds = %0, %33
%11 = phi i32 [ %37, %33 ], [ 0, %0 ]
%12 = phi double [ %35, %33 ], [ 0.000000e+00, %0 ]
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, double* %1)
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 19
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load double, double* %1
%18 = sitofp i32 %14 to double
%19 = fmul double %17, %18
%20 = fmul double %19, 8.000000e+01
%21 = fdiv double %20, 1.000000e+02
br label %33
22: ; preds = %10
%23 = sdiv i32 %14, 2
%24 = shl nsw i32 %23, 1
%25 = sitofp i32 %24 to double
%26 = load double, double* %1
%27 = fmul double %26, %25
%28 = fmul double %27, 9.000000e+01
%29 = fdiv double %28, 1.000000e+02
%30 = srem i32 %14, 2
%31 = sitofp i32 %30 to double
%32 = call double @llvm.fmuladd.f64(double %31, double %26, double %29)
br label %33
33: ; preds = %22, %16
%34 = phi double [ %21, %16 ], [ %32, %22 ]
%35 = fadd double %12, %34
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %34)
%37 = add nuw nsw i32 %11, 1
%38 = load i32, i32* %3
%39 = icmp slt i32 %37, %38
br i1 %39, label %10, label %40
40: ; preds = %33, %0
%41 = phi double [ 0.000000e+00, %0 ], [ %35, %33 ]
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %41)
ret i32 0
}