#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 kuvvet_hesabi(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("Programdan cikmak icin us ve tabani -1 giriniz.\n");
  int girilen_taban;
  int girilen_us;
  int sonsuz_dongu = 0;
  while (sonsuz_dongu < 1) {
    printf("Us'su alinacak sayiyi giriniz: ");
    scanf("%d", &girilen_taban);
    printf("Sayinin Us'sunu giriniz: ");
    scanf("%d", &girilen_us);
    if ((girilen_taban == -1) && (girilen_us == -1)) {
      printf("Programdan ciktiniz :)");
      break;
    }
    int sayinin_ussu;
    if (girilen_us >= 0) {
      sayinin_ussu = kuvvet_hesabi(girilen_taban, girilen_us);
      printf("%10s%10s%10s\n", "Taban", "Ust", "Sonuc");
      printf("%10d%10d%10d\n", girilen_taban, girilen_us, sayinin_ussu);
    } else {
      printf("Us kuvvetini negatif  bir sayi girmeyiniz.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jge    122b <main+0xfb>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    11c1 <main+0x91>
cmpl   $0xffffffff,-0xc(%rbp)
jne    11c1 <main+0x91>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122b <main+0xfb>
cmpl   $0x0,-0xc(%rbp)
jl     1218 <main+0xe8>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <kuvvet_hesabi@plt>
mov    %eax,-0x14(%rbp)
lea    0xea5(%rip),%rdi
lea    0xeac(%rip),%rsi
lea    0xeab(%rip),%rdx
lea    0xea8(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1226 <main+0xf6>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf34(%rip),%rdi
jmp    1157 <main+0x17>
xchg   %ax,%ax
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
cmp    $0xffffffff,%edi
jne    11ab <main+0x6b>
cmp    $0xffffffff,%esi
je     11f6 <main+0xb6>
test   %esi,%esi
js     1150 <main+0x10>
call   1040 <kuvvet_hesabi@plt>
mov    %eax,%ebx
lea    0xe97(%rip),%rdi
lea    0xe9e(%rip),%rsi
lea    0xe9d(%rip),%rdx
lea    0xe9a(%rip),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe8a(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    115c <main+0x1c>
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Programdan cikmak icin us ve tabani -1 giriniz.\0A\00"
@.str.1 = [32 x i8] c"Us'su alinacak sayiyi giriniz: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Sayinin Us'sunu giriniz: \00"
@.str.4 = [23 x i8] c"Programdan ciktiniz :)\00"
@.str.5 = [14 x i8] c"%10s%10s%10s\0A\00"
@.str.6 = [6 x i8] c"Taban\00"
@.str.7 = [4 x i8] c"Ust\00"
@.str.8 = [6 x i8] c"Sonuc\00"
@.str.9 = [14 x i8] c"%10d%10d%10d\0A\00"
@.str.10 = [44 x i8] c"Us kuvvetini negatif bir sayi girmeyiniz.\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
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %36, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %37
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %37
22: ; preds = %17, %10
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 @kuvvet_hesabi(i32 %26, i32 %27)
store i32 %28, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = load i32, i32* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %30, i32 %31, i32 %32)
br label %36
34: ; preds = %22
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0))
br label %36
36: ; preds = %34, %25
br label %7
37: ; preds = %20, %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"Us'su alinacak sayiyi giriniz: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Sayinin Us'sunu giriniz: \00"
@.str.4 = [23 x i8] c"Programdan ciktiniz :)\00"
@.str.5 = [14 x i8] c"%10s%10s%10s\0A\00"
@.str.6 = [6 x i8] c"Taban\00"
@.str.7 = [4 x i8] c"Ust\00"
@.str.8 = [6 x i8] c"Sonuc\00"
@.str.9 = [14 x i8] c"%10d%10d%10d\0A\00"
@str = [48 x i8] c"Programdan cikmak icin us ve tabani -1 giriniz.\00"
@str.11 = [43 x i8] c"Us kuvvetini negatif bir sayi girmeyiniz.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, -1
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, -1
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %29, %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
17: ; preds = %0, %29
%18 = phi i32 [ %36, %29 ], [ %12, %0 ]
%19 = phi i32 [ %34, %29 ], [ %10, %0 ]
%20 = icmp sgt i32 %18, -1
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = call i32 @kuvvet_hesabi(i32 %19, i32 %18)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %24, i32 %25, i32 %22)
br label %29
27: ; preds = %17
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0))
br label %29
29: ; preds = %27, %21
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%34 = load i32, i32* %1
%35 = icmp eq i32 %34, -1
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, -1
%38 = select i1 %35, i1 %37, i1 false
br i1 %38, label %15, label %17
}