#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ stdin;
int main() {
  int i, kind, num;
  double sum = 0;
  for (i = 1; i <= 5; i++) {
    printf("ÖÜ%dÏúÊÛÇé¿ö:\n", i);
    kind = 0;
    while (kind != -1) {
      fflush(stdin);
      scanf("%d,%d", &kind, &num);
      switch (kind) {
      case 1:
        sum += 2.98 * num;
        break;
      case 2:
        sum += 4.50 * num;
        break;
      case 3:
        sum += 9.98 * num;
        break;
      case 4:
        sum += 4.49 * num;
        break;
      case 5:
        sum += 6.87 * num;
        break;
      }
    }
  }
  printf("±¾ÖÜÏúÊÛ×Ü¶îÎª:%f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     128c <main+0x15c>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1279 <main+0x149>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     1274 <main+0x144>
mov    -0x20(%rbp),%rax
lea    0xe6c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe49(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1274 <main+0x144>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe1d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1274 <main+0x144>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xdf1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1274 <main+0x144>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xdc5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1274 <main+0x144>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd99(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1170 <main+0x40>
jmp    127e <main+0x14e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x1e>
movsd  -0x18(%rbp),%xmm0
lea    0xdc3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%r13d
movsd  0xeb4(%rip),%xmm1
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    0x2e8d(%rip),%rbp
lea    0xefb(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%rbx
lea    0xebd(%rip),%r14
movapd %xmm1,%xmm0
jmp    119c <main+0x6c>
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
addsd  0xe72(%rip),%xmm0
add    $0x1,%r13d
cmp    $0x6,%r13d
je     125d <main+0x12d>
lea    0xea1(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
jmp    11e3 <main+0xb3>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xe3f(%rip),%xmm0
nopl   0x0(%rax)
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
cmp    $0xffffffff,%eax
je     1180 <main+0x50>
mov    0x0(%rbp),%edi
call   1040 <fflush@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x4,%ecx
ja     11de <main+0xae>
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xe09(%rip),%xmm0
jmp    11d0 <main+0xa0>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xdee(%rip),%xmm0
jmp    11d0 <main+0xa0>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xdd3(%rip),%xmm0
jmp    11d0 <main+0xa0>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xdb8(%rip),%xmm0
jmp    11d0 <main+0xa0>
lea    0xdff(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\C3\96\C3\9C%d\C3\8F\C3\BA\C3\8A\C3\9B\C3\87\C3\A9\C2\BF\C3\B6:\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [33 x i8] c"\C2\B1\C2\BE\C3\96\C3\9C\C3\8F\C3\BA\C3\8A\C3\9B\C3\97\C3\9C\C2\B6\C3\AE\C3\8E\C2\AA:%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %5
store i32 1, i32* %2
br label %6
6: ; preds = %48, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 5
br i1 %8, label %9, label %51
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %11)
store i32 0, i32* %3
br label %13
13: ; preds = %46, %9
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %47
16: ; preds = %13
%17 = load i32, i32* @stdin
%18 = call i32 @fflush(i32 %17)
%19 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%20 = load i32, i32* %3
switch i32 %20, label %46 [
i32 1, label %21
i32 2, label %26
i32 3, label %31
i32 4, label %36
i32 5, label %41
]
21: ; preds = %16
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = load double, double* %5
%25 = call double @llvm.fmuladd.f64(double 2.980000e+00, double %23, double %24)
store double %25, double* %5
br label %46
26: ; preds = %16
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to double
%29 = load double, double* %5
%30 = call double @llvm.fmuladd.f64(double 4.500000e+00, double %28, double %29)
store double %30, double* %5
br label %46
31: ; preds = %16
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to double
%34 = load double, double* %5
%35 = call double @llvm.fmuladd.f64(double 9.980000e+00, double %33, double %34)
store double %35, double* %5
br label %46
36: ; preds = %16
%37 = load i32, i32* %4
%38 = sitofp i32 %37 to double
%39 = load double, double* %5
%40 = call double @llvm.fmuladd.f64(double 4.490000e+00, double %38, double %39)
store double %40, double* %5
br label %46
41: ; preds = %16
%42 = load i32, i32* %4
%43 = sitofp i32 %42 to double
%44 = load double, double* %5
%45 = call double @llvm.fmuladd.f64(double 6.870000e+00, double %43, double %44)
store double %45, double* %5
br label %46
46: ; preds = %16, %41, %36, %31, %26, %21
br label %13
47: ; preds = %13
br label %48
48: ; preds = %47
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %6
51: ; preds = %6
%52 = load double, double* %5
%53 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\C3\96\C3\9C%d\C3\8F\C3\BA\C3\8A\C3\9B\C3\87\C3\A9\C2\BF\C3\B6:\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [33 x i8] c"\C2\B1\C2\BE\C3\96\C3\9C\C3\8F\C3\BA\C3\8A\C3\9B\C3\97\C3\9C\C2\B6\C3\AE\C3\8E\C2\AA:%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %0, %39
%6 = phi double [ 0.000000e+00, %0 ], [ %37, %39 ]
%7 = phi i32 [ 1, %0 ], [ %40, %39 ]
%8 = sitofp i32 %7 to double
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %8)
store i32 0, i32* %1
br label %10
10: ; preds = %5, %36
%11 = phi double [ %6, %5 ], [ %37, %36 ]
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%15 = load i32, i32* %1
switch i32 %15, label %36 [
i32 1, label %16
i32 2, label %20
i32 3, label %24
i32 4, label %28
i32 5, label %32
]
16: ; preds = %10
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double %18, double 2.980000e+00, double %11)
br label %36
20: ; preds = %10
%21 = load i32, i32* %2
%22 = sitofp i32 %21 to double
%23 = call double @llvm.fmuladd.f64(double %22, double 4.500000e+00, double %11)
br label %36
24: ; preds = %10
%25 = load i32, i32* %2
%26 = sitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double %26, double 9.980000e+00, double %11)
br label %36
28: ; preds = %10
%29 = load i32, i32* %2
%30 = sitofp i32 %29 to double
%31 = call double @llvm.fmuladd.f64(double %30, double 4.490000e+00, double %11)
br label %36
32: ; preds = %10
%33 = load i32, i32* %2
%34 = sitofp i32 %33 to double
%35 = call double @llvm.fmuladd.f64(double %34, double 6.870000e+00, double %11)
br label %36
36: ; preds = %10, %32, %28, %24, %20, %16
%37 = phi double [ %11, %10 ], [ %35, %32 ], [ %31, %28 ], [ %27, %24 ], [ %23, %20 ], [ %19, %16 ]
%38 = icmp eq i32 %15, -1
br i1 %38, label %39, label %10
39: ; preds = %36
%40 = add nuw nsw i32 %7, 1
%41 = icmp eq i32 %40, 6
br i1 %41, label %42, label %5
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %37)
ret i32 0
}