#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 faktoriyel_hesapla(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char program_cikisi = 'e';
  while (program_cikisi != 'h') {
    int sayi;
    printf("Faktoriyeli hesaplanacak sayiyi giriniz: ");
    scanf("%d", &sayi);
    if (sayi >= 0) {
      long int sonuc = 0;
      sonuc = faktoriyel_hesapla(sayi);
      printf("%d! = %ld \n", sayi, sonuc);
    } else {
      printf("Pozitif bir sayi giriniz!!\n");
    }
    printf("Baska bir faktoriyel hesabi yapcakmisiniz?(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     11db <main+0xab>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     11a8 <main+0x78>
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <faktoriyel_hesapla@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <main+0x86>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1143 <main+0x13>
lea    0xeae(%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
push   %rax
movb   $0x65,0x3(%rsp)
lea    0xea9(%rip),%r14
lea    0xecc(%rip),%r15
lea    0x4(%rsp),%r13
lea    0xecf(%rip),%rbx
lea    0xeff(%rip),%rbp
lea    0x3(%rsp),%r12
jmp    11aa <main+0x6a>
nopl   0x0(%rax,%rax,1)
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpb   $0x68,0x3(%rsp)
je     11e5 <main+0xa5>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
js     1180 <main+0x40>
call   1060 <faktoriyel_hesapla@plt>
mov    0x4(%rsp),%esi
lea    0xe54(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118c <main+0x4c>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Faktoriyeli hesaplanacak sayiyi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"%d! = %ld \0A\00"
@.str.3 = [28 x i8] c"Pozitif bir sayi giriniz!!\0A\00"
@.str.4 = [55 x i8] c"Baska bir faktoriyel hesabi yapcakmisiniz?(e veya h): \00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [23 x i8] c"Programdan ciktiniz :)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
store i8 101, i8* %2
br label %5
5: ; preds = %22, %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 104
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %9
store i64 0, i64* %4
%15 = load i32, i32* %3
%16 = call i64 @faktoriyel_hesapla(i32 %15)
store i64 %16, i64* %4
%17 = load i32, i32* %3
%18 = load i64, i64* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %17, i64 %18)
br label %22
20: ; preds = %9
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %2)
br label %5
25: ; preds = %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Faktoriyeli hesaplanacak sayiyi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"%d! = %ld \0A\00"
@.str.4 = [55 x i8] c"Baska bir faktoriyel hesabi yapcakmisiniz?(e veya h): \00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [23 x i8] c"Programdan ciktiniz :)\00"
@str = [27 x i8] c"Pozitif bir sayi giriniz!!\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
store i8 101, i8* %1
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %0, %15
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = call i64 @faktoriyel_hesapla(i32 %7)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %11, i64 %10)
br label %15
13: ; preds = %4
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%18 = load i8, i8* %1
%19 = icmp eq i8 %18, 104
br i1 %19, label %20, label %4
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}