#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);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int water, charge;
  while (1) {
    scanf("%d", &water);
    if (water == -1)
      break;
    charge = 1150;
    water -= 10;
    if (water > 0) {
      if (water <= 10) {
        charge += water * 125;
      } else {
        charge += 10 * 125;
      }
      water -= 10;
    }
    if (water > 0) {
      if (water <= 10) {
        charge += water * 140;
      } else {
        charge += 10 * 140;
      }
      water -= 10;
    }
    if (water > 0)
      charge += water * 160;
    printf("%d\n", 4280 - charge);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    114e <main+0x2e>
jmp    11ff <main+0xdf>
movl   $0x47e,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1195 <main+0x75>
cmpl   $0xa,-0x8(%rbp)
jg     1181 <main+0x61>
imul   $0x7d,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    118c <main+0x6c>
mov    -0xc(%rbp),%eax
add    $0x4e2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11cf <main+0xaf>
cmpl   $0xa,-0x8(%rbp)
jg     11bb <main+0x9b>
imul   $0x8c,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11c6 <main+0xa6>
mov    -0xc(%rbp),%eax
add    $0x578,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11e6 <main+0xc6>
imul   $0xa0,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x10b8,%esi
sub    -0xc(%rbp),%esi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0xffffffff,%ecx
je     11e6 <main+0xc6>
mov    $0x960,%r13d
mov    $0x578,%r12d
xor    %ebp,%ebp
lea    0xea5(%rip),%r14
lea    0xe9b(%rip),%r15
lea    0x4(%rsp),%rbx
jmp    11a3 <main+0x83>
nopl   0x0(%rax)
mov    %edx,%ecx
shl    $0x5,%ecx
lea    (%rcx,%rcx,4),%esi
neg    %esi
test   %edx,%edx
cmovle %ebp,%esi
sub    %eax,%esi
add    $0x10b8,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0xffffffff,%ecx
je     11e6 <main+0xc6>
lea    -0xa(%rcx),%edx
mov    %edx,0x4(%rsp)
mov    $0x47e,%eax
cmp    $0xb,%ecx
jl     1170 <main+0x50>
imul   $0x7d,%edx,%eax
add    $0x47e,%eax
lea    -0x14(%rcx),%edx
mov    %edx,0x4(%rsp)
cmp    $0x15,%ecx
cmovae %r13d,%eax
jb     1170 <main+0x50>
imul   $0x8c,%edx,%esi
cmp    $0xb,%edx
cmovae %r12d,%esi
add    %esi,%eax
add    $0xffffffe2,%ecx
mov    %ecx,0x4(%rsp)
mov    %ecx,%edx
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %53
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %4
br label %57
9: ; preds = %4
store i32 1150, i32* %3
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 10
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %9
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* %2
%19 = mul nsw i32 %18, 125
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
br label %25
22: ; preds = %14
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1250
store i32 %24, i32* %3
br label %25
25: ; preds = %22, %17
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 10
store i32 %27, i32* %2
br label %28
28: ; preds = %25, %9
%29 = load i32, i32* %2
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %45
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sle i32 %32, 10
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* %2
%36 = mul nsw i32 %35, 140
%37 = load i32, i32* %3
%38 = add nsw i32 %37, %36
store i32 %38, i32* %3
br label %42
39: ; preds = %31
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1400
store i32 %41, i32* %3
br label %42
42: ; preds = %39, %34
%43 = load i32, i32* %2
%44 = sub nsw i32 %43, 10
store i32 %44, i32* %2
br label %45
45: ; preds = %42, %28
%46 = load i32, i32* %2
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = load i32, i32* %2
%50 = mul nsw i32 %49, 160
%51 = load i32, i32* %3
%52 = add nsw i32 %51, %50
store i32 %52, i32* %3
br label %53
53: ; preds = %48, %45
%54 = load i32, i32* %3
%55 = sub nsw i32 4280, %54
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
br label %4
57: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %35, label %6
6: ; preds = %0, %23
%7 = phi i32 [ %33, %23 ], [ %4, %0 ]
%8 = add nsw i32 %7, -10
store i32 %8, i32* %1
%9 = icmp sgt i32 %7, 10
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = icmp ult i32 %7, 21
%12 = mul nsw i32 %8, 125
%13 = add nsw i32 %12, 1150
%14 = select i1 %11, i32 %13, i32 2400
%15 = add nsw i32 %7, -20
store i32 %15, i32* %1
%16 = icmp ugt i32 %7, 20
br i1 %16, label %17, label %23
17: ; preds = %10
%18 = icmp ult i32 %15, 11
%19 = mul nsw i32 %15, 140
%20 = select i1 %18, i32 %19, i32 1400
%21 = add nsw i32 %14, %20
%22 = add nsw i32 %7, -30
store i32 %22, i32* %1
br label %23
23: ; preds = %6, %17, %10
%24 = phi i32 [ %22, %17 ], [ %15, %10 ], [ %8, %6 ]
%25 = phi i32 [ %21, %17 ], [ %14, %10 ], [ 1150, %6 ]
%26 = icmp sgt i32 %24, 0
%27 = mul i32 %24, -160
%28 = select i1 %26, i32 %27, i32 0
%29 = sub i32 4280, %25
%30 = add i32 %29, %28
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %6
35: ; preds = %23, %0
ret i32 0
}