#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *, unsigned int *);
int main(void) {
  unsigned int power(int base, unsigned int esponente);
  int base;
  unsigned int esponente;
  do {
    printf("%s", "Inserisci la base e la potenza del numero separati da uno "
                 "spazio (-666 per uscire): ");
    scanf("%u %u", &base, &esponente);
    if (base > 0 && esponente > 0) {
      printf("%d elevato a %u e' pari a: %u\n", base, esponente,
             power(base, esponente));
    } else {
      puts("Attenzione sono accettati solo interi positivi > 0");
    }
  } while (base >= 1 && esponente >= 1 && base != -666);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11be <main+0x7e>
cmpl   $0x0,-0xc(%rbp)
jbe    11be <main+0x7e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <power@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ca <main+0x8a>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
jmp    11cf <main+0x8f>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jl     11fa <main+0xba>
xor    %eax,%eax
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x15(%rbp)
jb     11fa <main+0xba>
cmpl   $0xfffffd66,-0x8(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%r15
lea    0xeff(%rip),%r12
lea    0x4(%rsp),%r13
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
jle    11d0 <main+0x90>
mov    (%rsp),%r14d
test   %r14d,%r14d
je     11d0 <main+0x90>
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <power@plt>
lea    0xead(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11dc <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xea6(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
cmp    $0xfffffd66,%eax
je     11f5 <main+0xb5>
test   %eax,%eax
jle    11f5 <main+0xb5>
cmpl   $0x0,(%rsp)
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [85 x i8] c"Inserisci la base e la potenza del numero separati da uno spazio (-666 per uscire): \00"
@.str.2 = [6 x i8] c"%u %u\00"
@.str.3 = [31 x i8] c"%d elevato a %u e' pari a: %u\0A\00"
@.str.4 = [51 x i8] c"Attenzione sono accettati solo interi positivi > 0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %31, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp ugt i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @power(i32 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %14, i32 %17)
br label %21
19: ; preds = %9, %4
%20 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 1
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp uge i32 %26, 1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp ne i32 %29, -666
br label %31
31: ; preds = %28, %25, %22
%32 = phi i1 [ false, %25 ], [ false, %22 ], [ %30, %28 ]
br i1 %32, label %4, label %33
33: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [85 x i8] c"Inserisci la base e la potenza del numero separati da uno spazio (-666 per uscire): \00"
@.str.2 = [6 x i8] c"%u %u\00"
@.str.3 = [31 x i8] c"%d elevato a %u e' pari a: %u\0A\00"
@.str.4 = [51 x i8] c"Attenzione sono accettati solo interi positivi > 0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %18, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = call i32 @power(i32 %8, i32 %10)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %10, i32 %14)
br label %18
16: ; preds = %5
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %13, %16
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, 0
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 0
%23 = select i1 %20, i1 %22, i1 false
%24 = icmp ne i32 %19, -666
%25 = and i1 %24, %23
br i1 %25, label %5, label %26
26: ; preds = %18
ret i32 0
}