#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 multiplicacion(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a = 0;
  int b = 0;
  int i = 0;
  int potencia = 0;
  printf("Ingrese A \n");
  scanf("%d", &a);
  printf("Ingrese B \n");
  scanf("%d", &b);
  for (i = 1; i <= b; i = i + 1) {
    potencia = multiplicacion(a, b);
  }
  printf("El resultado es %d \n", potencia);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11c6 <main+0x96>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <multiplicacion@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119e <main+0x6e>
mov    -0x14(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    11b6 <main+0x76>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edi
call   1050 <multiplicacion@plt>
mov    0x8(%rsp),%esi
add    $0x1,%ebx
cmp    %esi,%ebx
jl     11a0 <main+0x60>
jmp    11b8 <main+0x78>
xor    %eax,%eax
lea    0xe44(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [21 x i8] c"El resultado es %d \0A\00"
@str = [11 x i8] c"Ingrese A \00"
@str.4 = [11 x i8] c"Ingrese B \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 1
br i1 %10, label %19, label %11
11: ; preds = %0, %11
%12 = phi i32 [ %17, %11 ], [ %9, %0 ]
%13 = phi i32 [ %16, %11 ], [ 1, %0 ]
%14 = load i32, i32* %1
%15 = call i32 @multiplicacion(i32 %14, i32 %12)
%16 = add nuw nsw i32 %13, 1
%17 = load i32, i32* %2
%18 = icmp slt i32 %13, %17
br i1 %18, label %11, label %19
19: ; preds = %11, %0
%20 = phi i32 [ 0, %0 ], [ %15, %11 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %20)
ret i32 0
}