#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 pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
void main() {
  int i, j, m, a, n, sum;
  sum = 0;
  m = 0;
  printf("Please enter the number of a and n:");
  scanf("%d%d", &a, &n);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < i; j++) {
      m = m + a * pow(10, j);
    }
    sum = sum + m;
    m = 0;
  }
  printf("The result is %d", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11e3 <main+0xb3>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c5 <main+0x95>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    -0x20(%rbp),%ecx
mov    %eax,%edx
mov    -0x1c(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1182 <main+0x52>
mov    -0x18(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <main+0x3f>
mov    -0x18(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
xor    %r12d,%r12d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1285 <main+0x155>
mov    $0x1,%r13d
xor    %ecx,%ecx
xor    %r12d,%r12d
jmp    119c <main+0x6c>
nopl   (%rax)
add    %ebp,%r12d
lea    0x1(%r13),%eax
mov    0x14(%rsp),%ecx
add    $0x1,%ecx
cmp    0xc(%rsp),%r13d
mov    %eax,%r13d
jge    1285 <main+0x155>
mov    $0x0,%ebp
mov    $0x0,%ebx
mov    %ecx,0x14(%rsp)
cmp    $0x3,%ecx
jb     124a <main+0x11a>
mov    %r12d,0x10(%rsp)
mov    %r13d,%r14d
and    $0x7ffffffc,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%r12d
mov    $0xa,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
mov    %eax,%r15d
imul   %r12d,%r15d
add    %ebp,%r15d
mov    0x8(%rsp),%r12d
lea    0x1(%rbx),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,%ebp
imul   %r12d,%ebp
add    %r15d,%ebp
mov    0x8(%rsp),%r12d
lea    0x2(%rbx),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,%r15d
imul   %r12d,%r15d
add    %ebp,%r15d
mov    0x8(%rsp),%r12d
lea    0x3(%rbx),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,%ebp
imul   %r12d,%ebp
add    %r15d,%ebp
add    $0x4,%ebx
cmp    %r14d,%ebx
jne    11d0 <main+0xa0>
mov    0x10(%rsp),%r12d
test   $0x3,%r13b
je     1180 <main+0x50>
mov    %r13d,%r14d
and    $0x3,%r14d
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%r15d
mov    $0xa,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
imul   %r15d,%eax
add    %eax,%ebp
add    $0x1,%ebx
add    $0xffffffff,%r14d
jne    1260 <main+0x130>
jmp    1180 <main+0x50>
lea    0xd9d(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Please enter the number of a and n:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [17 x i8] c"The result is %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %6
store i32 0, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
store i32 1, i32* %1
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %1
%11 = load i32, i32* %5
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %9
store i32 0, i32* %2
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %2
%16 = load i32, i32* %1
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load i32, i32* %2
%22 = call i32 @pow(i32 10, i32 %21)
%23 = mul nsw i32 %20, %22
%24 = add nsw i32 %19, %23
store i32 %24, i32* %3
br label %25
25: ; preds = %18
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %14
28: ; preds = %14
%29 = load i32, i32* %6
%30 = load i32, i32* %3
%31 = add nsw i32 %29, %30
store i32 %31, i32* %6
store i32 0, i32* %3
br label %32
32: ; preds = %28
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %9
35: ; preds = %9
%36 = load i32, i32* %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %36)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Please enter the number of a and n:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [17 x i8] c"The result is %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %66, label %9
9: ; preds = %0, %59
%10 = phi i32 [ %65, %59 ], [ 0, %0 ]
%11 = phi i32 [ %61, %59 ], [ 0, %0 ]
%12 = phi i32 [ %62, %59 ], [ 1, %0 ]
%13 = and i32 %12, 3
%14 = icmp ult i32 %10, 3
br i1 %14, label %43, label %15
15: ; preds = %9
%16 = and i32 %12, 2147483644
br label %17
17: ; preds = %17, %15
%18 = phi i32 [ 0, %15 ], [ %39, %17 ]
%19 = phi i32 [ 0, %15 ], [ %40, %17 ]
%20 = phi i32 [ 0, %15 ], [ %41, %17 ]
%21 = load i32, i32* %1
%22 = call i32 @pow(i32 10, i32 %19)
%23 = mul nsw i32 %22, %21
%24 = add nsw i32 %23, %18
%25 = or i32 %19, 1
%26 = load i32, i32* %1
%27 = call i32 @pow(i32 10, i32 %25)
%28 = mul nsw i32 %27, %26
%29 = add nsw i32 %28, %24
%30 = or i32 %19, 2
%31 = load i32, i32* %1
%32 = call i32 @pow(i32 10, i32 %30)
%33 = mul nsw i32 %32, %31
%34 = add nsw i32 %33, %29
%35 = or i32 %19, 3
%36 = load i32, i32* %1
%37 = call i32 @pow(i32 10, i32 %35)
%38 = mul nsw i32 %37, %36
%39 = add nsw i32 %38, %34
%40 = add nuw nsw i32 %19, 4
%41 = add i32 %20, 4
%42 = icmp eq i32 %41, %16
br i1 %42, label %43, label %17
43: ; preds = %17, %9
%44 = phi i32 [ undef, %9 ], [ %39, %17 ]
%45 = phi i32 [ 0, %9 ], [ %39, %17 ]
%46 = phi i32 [ 0, %9 ], [ %40, %17 ]
%47 = icmp eq i32 %13, 0
br i1 %47, label %59, label %48
48: ; preds = %43, %48
%49 = phi i32 [ %55, %48 ], [ %45, %43 ]
%50 = phi i32 [ %56, %48 ], [ %46, %43 ]
%51 = phi i32 [ %57, %48 ], [ 0, %43 ]
%52 = load i32, i32* %1
%53 = call i32 @pow(i32 10, i32 %50)
%54 = mul nsw i32 %53, %52
%55 = add nsw i32 %54, %49
%56 = add nuw nsw i32 %50, 1
%57 = add i32 %51, 1
%58 = icmp eq i32 %57, %13
br i1 %58, label %59, label %48
59: ; preds = %48, %43
%60 = phi i32 [ %44, %43 ], [ %55, %48 ]
%61 = add nsw i32 %60, %11
%62 = add nuw nsw i32 %12, 1
%63 = load i32, i32* %2
%64 = icmp slt i32 %12, %63
%65 = add i32 %10, 1
br i1 %64, label %9, label %66
66: ; preds = %59, %0
%67 = phi i32 [ 0, %0 ], [ %61, %59 ]
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %67)
ret void
}