#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 basamak_sayisi_bulma(int);
int /*<<< orphan*/ girilen_sayi_ters_cevir(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("Programdan cikmak icin -1 giriniz.\n");
  int sonsuz_dongu = 0;
  while (sonsuz_dongu < 1) {
    int sayi;
    printf("Ters cevrilecek sayiyi giriniz: ");
    scanf("%d", &sayi);
    if (sayi == -1) {
      printf("Programdan ciktiniz :)");
      break;
    }
    int basamak_sayisi;
    basamak_sayisi = basamak_sayisi_bulma(sayi);
    printf("Girilen sayi = %d \n", sayi);
    printf("Ters Cevrilmis hali = ");
    girilen_sayi_ters_cevir(sayi, basamak_sayisi);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    11e3 <main+0xa3>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
jne    11a9 <main+0x69>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xa3>
mov    -0xc(%rbp),%edi
call   1060 <basamak_sayisi_bulma@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <girilen_sayi_ters_cevir@plt>
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0xffffffff,%edi
je     11f8 <main+0xa8>
lea    0xea5(%rip),%r14
lea    0xeb2(%rip),%r15
lea    0xe5c(%rip),%r12
lea    0xe76(%rip),%r13
lea    0x4(%rsp),%rbx
call   1070 <basamak_sayisi_bulma@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edi
mov    %ebp,%esi
call   1050 <girilen_sayi_ters_cevir@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0xffffffff,%edi
jne    11b0 <main+0x60>
lea    0xe25(%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 = [36 x i8] c"Programdan cikmak icin -1 giriniz.\0A\00"
@.str.1 = [33 x i8] c"Ters cevrilecek sayiyi giriniz: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"Programdan ciktiniz :)\00"
@.str.4 = [20 x i8] c"Girilen sayi = %d \0A\00"
@.str.5 = [23 x i8] c"Ters Cevrilmis hali = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %25
16: ; preds = %9
%17 = load i32, i32* %3
%18 = call i32 @basamak_sayisi_bulma(i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @girilen_sayi_ters_cevir(i32 %22, i32 %23)
br label %6
25: ; preds = %14, %6
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"Ters cevrilecek sayiyi giriniz: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"Programdan ciktiniz :)\00"
@.str.4 = [20 x i8] c"Girilen sayi = %d \0A\00"
@.str.5 = [23 x i8] c"Ters Cevrilmis hali = \00"
@str = [35 x i8] c"Programdan cikmak icin -1 giriniz.\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %20, label %8
8: ; preds = %0, %8
%9 = phi i32 [ %18, %8 ], [ %6, %0 ]
%10 = call i32 @basamak_sayisi_bulma(i32 %9)
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = call i32 @girilen_sayi_ters_cevir(i32 %14, i32 %10)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %8
20: ; preds = %8, %0
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}