#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 *);
int main() {
  int i;
  double bonus, bon1, bon2, bon4, bon6, bon10;
  bon1 = 100000 * 0.1;
  bon2 = bon1 + 100000 * 0.075;
  bon4 = bon2 + 200000 * 0.05;
  bon6 = bon4 + 200000 * 0.03;
  bon10 = bon6 + 400000 * 0.015;
  printf("请输入利润：");
  scanf("%d", &i);
  if (i < 100000)
    bonus = i * 0.1;
  else if (i < 200000)
    bonus = bon1 + (i - 100000) * 0.075;
  else if (i < 400000)
    bonus = bon2 + (i - 200000) * 0.05;
  else if (i < 600000)
    bonus = bon4 + (i - 400000) * 0.03;
  else if (i < 1000000)
    bonus = bon6 + (i - 600000) * 0.015;
  else
    bonus = bon10 + (i - 1000000) * 0.01;
  printf("奖金是：%10.2f\n", bonus);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xecc(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb2(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe98(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe86(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x186a0,-0x8(%rbp)
jge    11ca <main+0xaa>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12e4 <main+0x1c4>
cmpl   $0x30d40,-0x8(%rbp)
jge    1202 <main+0xe2>
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x186a0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe48(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12df <main+0x1bf>
cmpl   $0x61a80,-0x8(%rbp)
jge    123a <main+0x11a>
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x30d40,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe08(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12da <main+0x1ba>
cmpl   $0x927c0,-0x8(%rbp)
jge    1272 <main+0x152>
movsd  -0x28(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x61a80,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdc8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12d5 <main+0x1b5>
cmpl   $0xf4240,-0x8(%rbp)
jge    12aa <main+0x18a>
movsd  -0x30(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x927c0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd88(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12d0 <main+0x1b0>
movsd  -0x38(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0xf4240,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd55(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12d5 <main+0x1b5>
jmp    12da <main+0x1ba>
jmp    12df <main+0x1bf>
jmp    12e4 <main+0x1c4>
movsd  -0x10(%rbp),%xmm0
lea    0xd6e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf30(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1869f,%eax
jg     115c <main+0x3c>
cvtsi2sd %eax,%xmm0
mulsd  0xef9(%rip),%xmm0
jmp    11fd <main+0xdd>
cmp    $0x30d3f,%eax
ja     117e <main+0x5e>
add    $0xfffe7960,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xecc(%rip),%xmm0
addsd  0xecc(%rip),%xmm0
jmp    11fd <main+0xdd>
cmp    $0x61a7f,%eax
ja     11a0 <main+0x80>
add    $0xfffcf2c0,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe9a(%rip),%xmm0
addsd  0xe9a(%rip),%xmm0
jmp    11fd <main+0xdd>
cmp    $0x927bf,%eax
ja     11c2 <main+0xa2>
add    $0xfff9e580,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe68(%rip),%xmm0
addsd  0xe68(%rip),%xmm0
jmp    11fd <main+0xdd>
cmp    $0xf423f,%eax
ja     11e4 <main+0xc4>
add    $0xfff6d840,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe36(%rip),%xmm0
addsd  0xe36(%rip),%xmm0
jmp    11fd <main+0xdd>
add    $0xfff0bdc0,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe0b(%rip),%xmm0
addsd  0xe0b(%rip),%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\88\A9\E6\B6\A6\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"\E5\A5\96\E9\87\91\E6\98\AF\EF\BC\9A%10.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store double 1.000000e+04, double* %4
%9 = load double, double* %4
%10 = fadd double %9, 7.500000e+03
store double %10, double* %5
%11 = load double, double* %5
%12 = fadd double %11, 1.000000e+04
store double %12, double* %6
%13 = load double, double* %6
%14 = fadd double %13, 6.000000e+03
store double %14, double* %7
%15 = load double, double* %7
%16 = fadd double %15, 6.000000e+03
store double %16, double* %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 100000
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = load i32, i32* %2
%23 = sitofp i32 %22 to double
%24 = fmul double %23, 1.000000e-01
store double %24, double* %3
br label %71
25: ; preds = %0
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 200000
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load double, double* %4
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 100000
%32 = sitofp i32 %31 to double
%33 = call double @llvm.fmuladd.f64(double %32, double 0x3FB3333333333333, double %29)
store double %33, double* %3
br label %70
34: ; preds = %25
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 400000
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load double, double* %5
%39 = load i32, i32* %2
%40 = sub nsw i32 %39, 200000
%41 = sitofp i32 %40 to double
%42 = call double @llvm.fmuladd.f64(double %41, double 5.000000e-02, double %38)
store double %42, double* %3
br label %69
43: ; preds = %34
%44 = load i32, i32* %2
%45 = icmp slt i32 %44, 600000
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = load double, double* %6
%48 = load i32, i32* %2
%49 = sub nsw i32 %48, 400000
%50 = sitofp i32 %49 to double
%51 = call double @llvm.fmuladd.f64(double %50, double 3.000000e-02, double %47)
store double %51, double* %3
br label %68
52: ; preds = %43
%53 = load i32, i32* %2
%54 = icmp slt i32 %53, 1000000
br i1 %54, label %55, label %61
55: ; preds = %52
%56 = load double, double* %7
%57 = load i32, i32* %2
%58 = sub nsw i32 %57, 600000
%59 = sitofp i32 %58 to double
%60 = call double @llvm.fmuladd.f64(double %59, double 1.500000e-02, double %56)
store double %60, double* %3
br label %67
61: ; preds = %52
%62 = load double, double* %8
%63 = load i32, i32* %2
%64 = sub nsw i32 %63, 1000000
%65 = sitofp i32 %64 to double
%66 = call double @llvm.fmuladd.f64(double %65, double 1.000000e-02, double %62)
store double %66, double* %3
br label %67
67: ; preds = %61, %55
br label %68
68: ; preds = %67, %46
br label %69
69: ; preds = %68, %37
br label %70
70: ; preds = %69, %28
br label %71
71: ; preds = %70, %21
%72 = load double, double* %3
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %72)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\88\A9\E6\B6\A6\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"\E5\A5\96\E9\87\91\E6\98\AF\EF\BC\9A%10.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 100000
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = sitofp i32 %5 to double
%9 = fmul double %8, 1.000000e-01
br label %38
10: ; preds = %0
%11 = icmp ult i32 %5, 200000
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = add nsw i32 %5, -100000
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %14, double 0x3FB3333333333333, double 1.000000e+04)
br label %38
16: ; preds = %10
%17 = icmp ult i32 %5, 400000
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = add nsw i32 %5, -200000
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double %20, double 5.000000e-02, double 1.750000e+04)
br label %38
22: ; preds = %16
%23 = icmp ult i32 %5, 600000
br i1 %23, label %24, label %28
24: ; preds = %22
%25 = add nsw i32 %5, -400000
%26 = sitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double %26, double 3.000000e-02, double 2.750000e+04)
br label %38
28: ; preds = %22
%29 = icmp ult i32 %5, 1000000
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = add nsw i32 %5, -600000
%32 = sitofp i32 %31 to double
%33 = call double @llvm.fmuladd.f64(double %32, double 1.500000e-02, double 3.350000e+04)
br label %38
34: ; preds = %28
%35 = add nsw i32 %5, -1000000
%36 = sitofp i32 %35 to double
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e-02, double 3.950000e+04)
br label %38
38: ; preds = %12, %24, %34, %30, %18, %7
%39 = phi double [ %9, %7 ], [ %15, %12 ], [ %21, %18 ], [ %27, %24 ], [ %33, %30 ], [ %37, %34 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %39)
ret i32 0
}