#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 *, long long);
int /*<<< orphan*/ scanf(char *, long long *, long long *);
int main() {
  long long int a, b;
  scanf("%lld%lld", &a, &b);
  long long int i, j;
  long long int s = 0;
  for (i = a; i <= b; i++) {
    j = i;
    while (j != 0) {
      s = s + j % 10;
      j /= 10;
    }
  }
  printf("%lld\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11c2 <main+0xa2>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ac <main+0x8c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    -0x38(%rbp),%rax
add    %rdx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
jmp    1169 <main+0x49>
jmp    11b1 <main+0x91>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1153 <main+0x33>
mov    -0x30(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x10(%rsp),%r9
mov    0x8(%rsp),%r8
xor    %esi,%esi
cmp    %r8,%r9
jle    115e <main+0x3e>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
movabs $0x6666666666666667,%r10
66 66 66
jmp    117c <main+0x5c>
nopw   0x0(%rax,%rax,1)
lea    0x1(%r9),%rax
cmp    %r8,%r9
mov    %rax,%r9
je     114b <main+0x2b>
test   %r9,%r9
je     1170 <main+0x50>
mov    %r9,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdi,%rax
imul   %r10
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rdi,%rcx
sub    %rax,%rcx
add    %rcx,%rsi
add    $0x9,%rdi
cmp    $0x12,%rdi
mov    %rdx,%rdi
ja     1190 <main+0x70>
jmp    1170 <main+0x50>

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

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