#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 */
float fabs(float);
float pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
float sqrt(float);
int main() {
  int secim;
  float sayi, sonuc;
  printf("Bir sayi giriniz: ");
  scanf("%f", &sayi);
  printf("1: Sayinin karekokunu al\n2: Sayinin karesini al\n3: Sayinin mutlak "
         "degerini al\nSecim giriniz: ");
  scanf("%d", &secim);
  switch (secim) {
  case 1: {
    sonuc = sqrt(sayi);
    printf("sqrt(%f): %f\n", sayi, sonuc);
    break;
  }
  case 2: {
    sonuc = pow(sayi, 2);
    printf("pow(%f,2): %f\n", sayi, sonuc);
    break;
  }
  case 3: {
    sonuc = fabs(sayi);
    printf("fabs(%f): %f\n", sayi, sonuc);
    break;
  }
  defult : {
    printf("yanlis secim yaptiniz!\n");
    break;
  }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xe99(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x15(%rbp),%al
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x15(%rbp),%al
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11db <main+0x8b>
jmp    11b9 <main+0x69>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     120f <main+0xbf>
jmp    11ca <main+0x7a>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1248 <main+0xf8>
jmp    1277 <main+0x127>
movss  -0xc(%rbp),%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe74(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1277 <main+0x127>
movss  -0xc(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe49(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1277 <main+0x127>
movss  -0xc(%rbp),%xmm0
call   1040 <fabs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe24(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11a7 <main+0x67>
cmp    $0x2,%eax
je     11bf <main+0x7f>
cmp    $0x1,%eax
jne    11fd <main+0xbd>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11d7 <main+0x97>
sqrtss %xmm0,%xmm0
jmp    11dc <main+0x9c>
movss  (%rsp),%xmm1
movaps 0xe4d(%rip),%xmm0
andps  %xmm1,%xmm0
lea    0xee7(%rip),%rdi
jmp    11e8 <main+0xa8>
movss  (%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
lea    0xec0(%rip),%rdi
jmp    11e3 <main+0xa3>
call   1060 <sqrt@plt>
lea    0xea4(%rip),%rdi
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Bir sayi giriniz: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [94 x i8] c"1: Sayinin karekokunu al\0A2: Sayinin karesini al\0A3: Sayinin mutlak degerini al\0ASecim giriniz: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [14 x i8] c"sqrt(%f): %f\0A\00"
@.str.5 = [15 x i8] c"pow(%f,2): %f\0A\00"
@.str.6 = [14 x i8] c"fabs(%f): %f\0A\00"
@.str.7 = [24 x i8] c"yanlis secim yaptiniz!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 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), float* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %36 [
i32 1, label %10
i32 2, label %18
i32 3, label %26
]
10: ; preds = %0
%11 = load float, float* %3
%12 = call float @sqrt(float %11)
store float %12, float* %4
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %14, double %16)
br label %36
18: ; preds = %0
%19 = load float, float* %3
%20 = call float @pow(float %19, i32 2)
store float %20, float* %4
%21 = load float, float* %3
%22 = fpext float %21 to double
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %22, double %24)
br label %36
26: ; preds = %0
%27 = load float, float* %3
%28 = call float @fabs(float %27)
store float %28, float* %4
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = load float, float* %4
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %30, double %32)
br label %36
34: ; No predecessors!
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %36
36: ; preds = %0, %34, %26, %18, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Bir sayi giriniz: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [94 x i8] c"1: Sayinin karekokunu al\0A2: Sayinin karesini al\0A3: Sayinin mutlak degerini al\0ASecim giriniz: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [14 x i8] c"sqrt(%f): %f\0A\00"
@.str.5 = [15 x i8] c"pow(%f,2): %f\0A\00"
@.str.6 = [14 x i8] c"fabs(%f): %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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), float* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %28 [
i32 1, label %10
i32 2, label %14
i32 3, label %18
]
10: ; preds = %0
%11 = load float, float* %2
%12 = call float @sqrt(float %11)
%13 = load float, float* %2
br label %21
14: ; preds = %0
%15 = load float, float* %2
%16 = call float @pow(float %15, i32 2)
%17 = load float, float* %2
br label %21
18: ; preds = %0
%19 = load float, float* %2
%20 = call float @llvm.fabs.f32(float %19)
br label %21
21: ; preds = %10, %14, %18
%22 = phi float [ %19, %18 ], [ %17, %14 ], [ %13, %10 ]
%23 = phi float [ %20, %18 ], [ %16, %14 ], [ %12, %10 ]
%24 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), %18 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %14 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %10 ]
%25 = fpext float %22 to double
%26 = fpext float %23 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %24, double %25, double %26)
br label %28
28: ; preds = %21, %0
ret i32 0
}