#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 fibonacci_hesapla(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char program_cikisi = 'e';
  while (program_cikisi != 'h') {
    int hesaplanacak_sayi;
    printf("Hesaplanmasi istediginiz fibonacci sayisini giriniz: ");
    scanf("%d", &hesaplanacak_sayi);
    if (hesaplanacak_sayi >= 0) {
      long int sonuc = 0;
      sonuc = fibonacci_hesapla(hesaplanacak_sayi);
      printf("fibonacci %d nin degeri %ld dir\n", hesaplanacak_sayi, sonuc);
      printf(
          "Baska bir fibonacci sayisi hesaplamak istiyormusunuz?(e veya h): ");
      scanf(" %c", &program_cikisi);
    } else {
      printf("Negatif bir sayi girdiniz!!\n");
    }
  }
  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    0xed1(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     11c8 <main+0x98>
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fibonacci_hesapla@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
jmp    11d6 <main+0xa6>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1143 <main+0x13>
lea    0xedb(%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    0xed8(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xef0(%rip),%r13
lea    0xf2b(%rip),%rbp
lea    0x3(%rsp),%r12
jmp    1193 <main+0x53>
nopl   0x0(%rax,%rax,1)
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
cmpb   $0x68,0x3(%rsp)
je     11ea <main+0xaa>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
js     1180 <main+0x40>
call   1050 <fibonacci_hesapla@plt>
mov    0x4(%rsp),%esi
lea    0xe77(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x68,0x3(%rsp)
jne    1193 <main+0x53>
lea    0xeaf(%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 = [54 x i8] c"Hesaplanmasi istediginiz fibonacci sayisini giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"fibonacci %d nin degeri %ld dir\0A\00"
@.str.3 = [66 x i8] c"Baska bir fibonacci sayisi hesaplamak istiyormusunuz?(e veya h): \00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [29 x i8] c"Negatif bir sayi girdiniz!!\0A\00"
@.str.6 = [21 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 = %24, %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 ([54 x i8], [54 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 %22
14: ; preds = %9
store i64 0, i64* %4
%15 = load i32, i32* %3
%16 = call i64 @fibonacci_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 ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %17, i64 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
br label %24
22: ; preds = %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %24
24: ; preds = %22, %14
br label %5
25: ; preds = %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"Hesaplanmasi istediginiz fibonacci sayisini giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"fibonacci %d nin degeri %ld dir\0A\00"
@.str.3 = [66 x i8] c"Baska bir fibonacci sayisi hesaplamak istiyormusunuz?(e veya h): \00"
@.str.4 = [4 x i8] c" %c\00"
@.str.6 = [21 x i8] c"Programdan ciktiniz.\00"
@str = [28 x i8] c"Negatif bir sayi girdiniz!!\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, %17
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 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 %15
9: ; preds = %4
%10 = call i64 @fibonacci_hesapla(i32 %7)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11, i64 %10)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %17
15: ; preds = %4
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %9
%18 = load i8, i8* %1
%19 = icmp eq i8 %18, 104
br i1 %19, label %20, label %4
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}