#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 */
scalar_t__ get(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, char *argv[]) {
  int q, i, j = 0, n;
  scanf("%i %i", &n, &q);
  for (i = 1; i <= n; ++i) {
    j += get(i, q);
  }
  printf("%i", j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <scanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     119a <main+0x6a>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <get@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1168 <main+0x38>
mov    -0x1c(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1177 <main+0x47>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    0x4(%rsp),%esi
mov    %ebp,%edi
call   1040 <get@plt>
add    %eax,%ebx
cmp    (%rsp),%ebp
jl     1160 <main+0x30>
jmp    1179 <main+0x49>
xor    %ebx,%ebx
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %3)
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 1
br i1 %9, label %20, label %10
10: ; preds = %2, %10
%11 = phi i32 [ %16, %10 ], [ 0, %2 ]
%12 = phi i32 [ %17, %10 ], [ 1, %2 ]
%13 = load i32, i32* %3
%14 = call i64 @get(i32 %12, i32 %13)
%15 = trunc i64 %14 to i32
%16 = add i32 %11, %15
%17 = add nuw nsw i32 %12, 1
%18 = load i32, i32* %4
%19 = icmp slt i32 %12, %18
br i1 %19, label %10, label %20
20: ; preds = %10, %2
%21 = phi i32 [ 0, %2 ], [ %16, %10 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}