#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 scanf(char *, int *);
int main(void) {
  int inicio, quantidade, soma = 0;
  scanf("%d", &inicio);
  while (scanf("%d", &quantidade), quantidade < 1)
    ;
  while (quantidade-- > 0) {
    soma += inicio++;
  }
  printf("%d\n", soma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jge    1165 <main+0x45>
jmp    1146 <main+0x26>
jmp    116a <main+0x4a>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1194 <main+0x74>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116a <main+0x4a>
mov    -0x10(%rbp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
jle    1140 <main+0x20>
mov    0x4(%rsp),%ecx
xor    %edx,%edx
mov    %eax,%edi
add    $0xffffffff,%edi
cmovs  %edi,%edx
sub    %edx,%edi
lea    0x1(%rcx),%ebx
imul   %edi,%ebx
add    %ecx,%ebx
mov    %eax,%esi
sub    %edx,%esi
add    $0xfffffffe,%esi
imul   %rdi,%rsi
shr    %rsi
add    %ebx,%esi
add    %ecx,%eax
sub    %edx,%eax
mov    %eax,0x4(%rsp)
movl   $0xffffffff,(%rsp)
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %10, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
br label %12
12: ; preds = %16, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1
store i32 %14, i32* %3
%15 = icmp sgt i32 %13, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
%19 = load i32, i32* %4
%20 = add nsw i32 %19, %17
store i32 %20, i32* %4
br label %12
21: ; preds = %12
%22 = load i32, i32* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
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 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %6
6: ; preds = %6, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %6, label %10
10: ; preds = %6
%11 = load i32, i32* %1
%12 = add nsw i32 %8, -1
%13 = call i32 @llvm.smin.i32(i32 %12, i32 0)
%14 = sub nuw nsw i32 %12, %13
%15 = add i32 %11, 1
%16 = mul i32 %14, %15
%17 = add i32 %11, %16
%18 = zext i32 %14 to i33
%19 = add nsw i32 %8, -2
%20 = sub nuw nsw i32 %19, %13
%21 = zext i32 %20 to i33
%22 = mul i33 %18, %21
%23 = lshr i33 %22, 1
%24 = trunc i33 %23 to i32
%25 = add i32 %17, %24
%26 = add i32 %8, %11
%27 = sub nuw nsw i32 %26, %13
store i32 %27, i32* %1
store i32 -1, i32* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret i32 0
}