#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 *, int *);
int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  int sum = a;
  while (a * c + 1 < b) {
    a *= c++;
    sum += a;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jge    1180 <main+0x60>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x2d>
mov    -0x14(%rbp),%esi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%r8d
mov    0xc(%rsp),%eax
mov    %eax,%edx
imul   %esi,%edx
lea    0x1(%rdx),%edi
cmp    %r8d,%edi
jge    117c <main+0x5c>
nopl   0x0(%rax)
mov    %edx,%edi
add    $0x1,%eax
add    %edx,%esi
mov    %eax,%edx
imul   %edi,%edx
lea    0x1(%rdx),%ecx
cmp    %r8d,%ecx
jl     1160 <main+0x40>
mov    %eax,0xc(%rsp)
mov    %edi,0x10(%rsp)
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %2
store i32 %7, i32* %5
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %8
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %2
%19 = mul nsw i32 %18, %16
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = add nsw i32 %21, %20
store i32 %22, i32* %5
br label %8
23: ; preds = %8
%24 = load i32, i32* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, %8
%12 = add nsw i32 %11, 1
%13 = icmp slt i32 %12, %9
br i1 %13, label %14, label %24
14: ; preds = %0, %14
%15 = phi i32 [ %20, %14 ], [ %11, %0 ]
%16 = phi i32 [ %19, %14 ], [ %8, %0 ]
%17 = phi i32 [ %18, %14 ], [ %10, %0 ]
%18 = add nsw i32 %17, 1
%19 = add nsw i32 %15, %16
%20 = mul nsw i32 %18, %15
%21 = add nsw i32 %20, 1
%22 = icmp slt i32 %21, %9
br i1 %22, label %14, label %23
23: ; preds = %14
store i32 %18, i32* %3
store i32 %15, i32* %1
br label %24
24: ; preds = %23, %0
%25 = phi i32 [ %19, %23 ], [ %8, %0 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret i32 0
}