#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 scanf(char *, double *, int *);
double tavan(double, int);
int main(void) {
  int n;
  double x, p;
  printf("Entetr base and exponent or Q to quit:\n");
  while (scanf("%lf"
               "%d",
               &p, &n) == 2) {
    x = tavan(p, n);
    printf("%g to the power %d is equal to %g.\n", p, n, x);
    printf("\nEntetr base and exponent or Q to quit:\n");
    scanf("%lf"
          "%d",
          &p, &n);
  }
  printf("done!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11be <main+0x8e>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1040 <tavan@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm1
lea    0xe76(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe54(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
jmp    114d <main+0x1d>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jne    11ef <main+0xaf>
lea    0xe8b(%rip),%r14
lea    0xeae(%rip),%r15
lea    0xe77(%rip),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x8(%rsp),%xmm0
mov    0x4(%rsp),%edi
call   1050 <tavan@plt>
movaps %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
mov    0x4(%rsp),%esi
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
je     11a0 <main+0x60>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Entetr base and exponent or Q to quit:\0A\00"
@.str.1 = [6 x i8] c"%lf%d\00"
@.str.2 = [36 x i8] c"%g to the power %d is equal to %g.\0A\00"
@.str.3 = [41 x i8] c"\0AEntetr base and exponent or Q to quit:\0A\00"
@.str.4 = [6 x i8] c"done!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %9, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %4, i32* %2)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load double, double* %4
%11 = load i32, i32* %2
%12 = call double @tavan(double %10, i32 %11)
store double %12, double* %3
%13 = load double, double* %4
%14 = load i32, i32* %2
%15 = load double, double* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %13, i32 %14, double %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %4, i32* %2)
br label %6
19: ; preds = %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%lf%d\00"
@.str.2 = [36 x i8] c"%g to the power %d is equal to %g.\0A\00"
@.str.4 = [6 x i8] c"done!\00"
@str = [39 x i8] c"Entetr base and exponent or Q to quit:\00"
@str.5 = [40 x i8] c"\0AEntetr base and exponent or Q to quit:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 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), double* %2, i32* %1)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %19
8: ; preds = %0, %8
%9 = load double, double* %2
%10 = load i32, i32* %1
%11 = call double @tavan(double %9, i32 %10)
%12 = load double, double* %2
%13 = load i32, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %12, i32 %13, double %11)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %2, i32* %1)
%17 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %2, i32* %1)
%18 = icmp eq i32 %17, 2
br i1 %18, label %8, label %19
19: ; preds = %8, %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}