#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 */
long kuvvet_alma(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char program_cikisi = 'e';
  while (program_cikisi != 'h') {
    int sayi = 0;
    printf("Kuvveti alinacak sayiyi giriniz: ");
    scanf("%d", &sayi);
    int kuvvet = 0;
    printf("Kuvveti giriniz: ");
    scanf("%d", &kuvvet);
    long int sonuc;
    if (sayi >= 0 && kuvvet >= 0) {
      sonuc = kuvvet_alma(sayi, kuvvet);
      printf("tabani %d kuvveti %d olan sayinin sonucu = %ld\n", sayi, kuvvet,
             sonuc);
    } else {
      printf("Sayiyi veya Kuvveti negatif girdiniz!!\n");
    }
    printf("Baska sayi hesaplamak istiyormusunuz?(e veya h): ");
    scanf(" %c", &program_cikisi);
  }
  printf("Programdan ciktiniz.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x65,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x68,%eax
je     1211 <main+0xe1>
movl   $0x0,-0xc(%rbp)
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x10(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     11de <main+0xae>
cmpl   $0x0,-0x10(%rbp)
jl     11de <main+0xae>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <kuvvet_alma@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <main+0xbc>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
jmp    1143 <main+0x13>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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
sub    $0x18,%rsp
movb   $0x65,0xf(%rsp)
lea    0xec8(%rip),%rbx
lea    0xec4(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xefa(%rip),%rbp
lea    0xf25(%rip),%r14
lea    0xf(%rsp),%r15
jmp    11aa <main+0x6a>
nopl   0x0(%rax,%rax,1)
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x68,0xf(%rsp)
je     1221 <main+0xe1>
movl   $0x0,0x14(%rsp)
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movl   $0x0,0x10(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x14(%rsp),%edi
test   %edi,%edi
js     1180 <main+0x40>
mov    0x10(%rsp),%esi
test   %esi,%esi
js     1180 <main+0x40>
call   1050 <kuvvet_alma@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xe25(%rip),%rdi
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118c <main+0x4c>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Kuvveti alinacak sayiyi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Kuvveti giriniz: \00"
@.str.3 = [48 x i8] c"tabani %d kuvveti %d olan sayinin sonucu = %ld\0A\00"
@.str.4 = [40 x i8] c"Sayiyi veya Kuvveti negatif girdiniz!!\0A\00"
@.str.5 = [50 x i8] c"Baska sayi hesaplamak istiyormusunuz?(e veya h): \00"
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [21 x i8] c"Programdan ciktiniz.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 0, i32* %1
store i8 101, i8* %2
br label %6
6: ; preds = %30, %0
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 104
br i1 %9, label %10, label %33
10: ; preds = %6
store i32 0, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %3
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %10
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i64 @kuvvet_alma(i32 %21, i32 %22)
store i64 %23, i64* %5
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = load i64, i64* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %25, i64 %26)
br label %30
28: ; preds = %17, %10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %2)
br label %6
33: ; preds = %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Kuvveti alinacak sayiyi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Kuvveti giriniz: \00"
@.str.3 = [48 x i8] c"tabani %d kuvveti %d olan sayinin sonucu = %ld\0A\00"
@.str.5 = [50 x i8] c"Baska sayi hesaplamak istiyormusunuz?(e veya h): \00"
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [21 x i8] c"Programdan ciktiniz.\00"
@str = [39 x i8] c"Sayiyi veya Kuvveti negatif girdiniz!!\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
store i8 101, i8* %1
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
br label %6
6: ; preds = %0, %23
store i32 0, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, -1
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, -1
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %21
16: ; preds = %6
%17 = call i64 @kuvvet_alma(i32 %11, i32 %13)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %19, i64 %17)
br label %23
21: ; preds = %6
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%26 = load i8, i8* %1
%27 = icmp eq i8 %26, 104
br i1 %27, label %28, label %6
28: ; preds = %23
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}