#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 main() {
  int br, cena, BroiZaOtstupka, kupeni = 0;
  float otstupkanow = 0, krainasum = 0;
  scanf("%d", &br);
  scanf("%d", &cena);
  scanf("%d", &BroiZaOtstupka);
  do {
    kupeni = kupeni + BroiZaOtstupka;
    if (kupeni > br) {
      BroiZaOtstupka = kupeni - br;
    }
    krainasum = krainasum + BroiZaOtstupka * (cena - (otstupkanow * cena));
    otstupkanow = otstupkanow + 0.02;
  } while (kupeni < br);
  printf("%.0f", krainasum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeab(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1194 <main+0x74>
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movss  -0x1c(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm3
movss  -0x18(%rbp),%xmm2
cvtsi2ssl -0xc(%rbp),%xmm4
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe20(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1176 <main+0x56>
movss  -0x1c(%rbp),%xmm0
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cvtsi2ssl 0x8(%rsp),%xmm1
xorps  %xmm3,%xmm3
xor    %ecx,%ecx
mov    0x4(%rsp),%edx
movsd  0xe92(%rip),%xmm2
xorps  %xmm0,%xmm0
jmp    11b0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm4,%xmm4
cvtsi2ss %edx,%xmm4
xorps  %xmm5,%xmm5
cvtss2sd %xmm3,%xmm5
mulss  %xmm1,%xmm3
movaps %xmm1,%xmm6
subss  %xmm3,%xmm6
mulss  %xmm4,%xmm6
addss  %xmm6,%xmm0
addsd  %xmm2,%xmm5
xorps  %xmm3,%xmm3
cvtsd2ss %xmm5,%xmm3
cmp    %eax,%ecx
jge    11c0 <main+0xa0>
add    %edx,%ecx
mov    %ecx,%esi
sub    %eax,%esi
jle    1180 <main+0x60>
mov    %esi,0x4(%rsp)
mov    %esi,%edx
jmp    1180 <main+0x60>
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %11
11: ; preds = %38, %0
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %11
%19 = load i32, i32* %5
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %4
br label %22
22: ; preds = %18, %11
%23 = load float, float* %7
%24 = load i32, i32* %4
%25 = sitofp i32 %24 to float
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to float
%28 = load float, float* %6
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to float
%31 = fneg float %28
%32 = call float @llvm.fmuladd.f32(float %31, float %30, float %27)
%33 = call float @llvm.fmuladd.f32(float %25, float %32, float %23)
store float %33, float* %7
%34 = load float, float* %6
%35 = fpext float %34 to double
%36 = fadd double %35, 2.000000e-02
%37 = fptrunc double %36 to float
store float %37, float* %6
br label %38
38: ; preds = %22
%39 = load i32, i32* %5
%40 = load i32, i32* %2
%41 = icmp slt i32 %39, %40
br i1 %41, label %11, label %42
42: ; preds = %38
%43 = load float, float* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %3
br label %14
14: ; preds = %23, %0
%15 = phi i32 [ %13, %0 ], [ %24, %23 ]
%16 = phi i32 [ 0, %0 ], [ %19, %23 ]
%17 = phi float [ 0.000000e+00, %0 ], [ %31, %23 ]
%18 = phi float [ 0.000000e+00, %0 ], [ %28, %23 ]
%19 = add nsw i32 %15, %16
%20 = icmp sgt i32 %19, %10
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = sub nsw i32 %19, %10
store i32 %22, i32* %3
br label %23
23: ; preds = %21, %14
%24 = phi i32 [ %22, %21 ], [ %15, %14 ]
%25 = sitofp i32 %24 to float
%26 = fneg float %17
%27 = call float @llvm.fmuladd.f32(float %26, float %12, float %12)
%28 = call float @llvm.fmuladd.f32(float %25, float %27, float %18)
%29 = fpext float %17 to double
%30 = fadd double %29, 2.000000e-02
%31 = fptrunc double %30 to float
%32 = icmp slt i32 %19, %10
br i1 %32, label %14, label %33
33: ; preds = %23
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float %28)
ret i32 0
}