#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);
scalar_t__ scanf(char *, double *);
int main() {
  double n, i, a, ans;
  while (scanf("%lf", &n)) {
    if (n < 0)
      break;
    ans = (n * n + n + 2) / 2;
    printf("%.0lf\n", ans);
    ans = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11b3 <main+0x93>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    115c <main+0x3c>
jmp    11b3 <main+0x93>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe8d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xee8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11b4 <main+0x94>
movsd  0x8(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     11b4 <main+0x94>
lea    0xec6(%rip),%r14
lea    0xebb(%rip),%r15
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe7c(%rip),%xmm0
mulsd  0xe7c(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11b4 <main+0x94>
movsd  0x8(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
br label %6
6: ; preds = %13, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load double, double* %2
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %9
br label %22
13: ; preds = %9
%14 = load double, double* %2
%15 = load double, double* %2
%16 = load double, double* %2
%17 = call double @llvm.fmuladd.f64(double %14, double %15, double %16)
%18 = fadd double %17, 2.000000e+00
%19 = fdiv double %18, 2.000000e+00
store double %19, double* %5
%20 = load double, double* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %20)
store double 1.000000e+00, double* %5
br label %6
22: ; preds = %12, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = icmp eq i64 %3, 0
%5 = load double, double* %1
%6 = fcmp olt double %5, 0.000000e+00
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %19, label %8
8: ; preds = %0, %8
%9 = phi double [ %16, %8 ], [ %5, %0 ]
%10 = call double @llvm.fmuladd.f64(double %9, double %9, double %9)
%11 = fadd double %10, 2.000000e+00
%12 = fmul double %11, 5.000000e-01
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%15 = icmp eq i64 %14, 0
%16 = load double, double* %1
%17 = fcmp olt double %16, 0.000000e+00
%18 = select i1 %15, i1 true, i1 %17
br i1 %18, label %19, label %8
19: ; preds = %8, %0
ret i32 0
}