#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 leeNumero();
int potencia(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int base;
  int exponente;
  int resultado;
  while (base != 0) {
    printf("Introduzca la base:");
    base = leeNumero();
    printf("Introduzca el exponente:");
    exponente = leeNumero();
    resultado = potencia(base, exponente);
    printf("El resultado de %d elevado a %d es %d.\n", base, exponente,
           resultado);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a3 <main+0x73>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <leeNumero@plt>
mov    %eax,-0x8(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <leeNumero@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <potencia@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%r14
lea    0xece(%rip),%r15
lea    0xee0(%rip),%r12
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <leeNumero@plt>
mov    %eax,%ebp
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <leeNumero@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <potencia@plt>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Introduzca la base:\00"
@.str.1 = [25 x i8] c"Introduzca el exponente:\00"
@.str.2 = [40 x i8] c"El resultado de %d elevado a %d es %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @leeNumero()
store i32 %10, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (...) @leeNumero()
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @potencia(i32 %13, i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
br label %5
20: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Introduzca la base:\00"
@.str.1 = [25 x i8] c"Introduzca el exponente:\00"
@.str.2 = [40 x i8] c"El resultado de %d elevado a %d es %d.\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @leeNumero()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @leeNumero()
%6 = tail call i32 @potencia(i32 %3, i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %5, i32 %6)
%8 = icmp eq i32 %3, 0
br i1 %8, label %9, label %1
9: ; preds = %1
ret i32 0
}