#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 /*<<< orphan*/ scanf(char *, int *, int *);
void powerandbase() {
  int i, j, k, a = 0, b = 0;
  printf("Enter the Base and Power: ");
  scanf("%d %d", &j, &k);
  for (i = 0; i <= k; i++) {
    a = j * i;
    b = a * i;
  }
  printf("Answer is %d", b);
}


x86 assembly (clang, -O0):
<powerandbase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     118d <powerandbase+0x6d>
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <powerandbase+0x3f>
mov    -0x14(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powerandbase>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%esi
imul   %eax,%esi
imul   0xc(%rsp),%esi
test   %eax,%eax
cmovs  %ebx,%esi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"Enter the Base and Power: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [13 x i8] c"Answer is %d\00"
define void @powerandbase() {
%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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 0
%9 = load i32, i32* %1
%10 = mul i32 %7, %7
%11 = mul i32 %10, %9
%12 = select i1 %8, i32 0, i32 %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret void
}