#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int exponant(int x) {
  int k;
  float total, pay, payda, terim;
  printf("X degerini giriniz: ");
  scanf("%d", &x);
  total = 1;
  pay = x;
  payda = 1;
  for (k = 2; k <= 10; k = k + 1) {
    terim = pay / payda;
    total = terim;
    pay *= x;
    payda *= k;
  }
  printf("Toplam = %.4f\n", total);
}


x86 assembly (clang, -O0):
<exponant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeaf(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe98(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     11c3 <exponant+0xa3>
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <exponant+0x54>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponant>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cvtsi2ssl 0x4(%rsp),%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
divss  0xe8b(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"X degerini giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Toplam = %.4f\0A\00"
define i32 @exponant(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 %0, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store float 1.000000e+00, float* %5
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
store float %12, float* %6
store float 1.000000e+00, float* %7
store i32 2, i32* %4
br label %13
13: ; preds = %29, %1
%14 = load i32, i32* %4
%15 = icmp sle i32 %14, 10
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = load float, float* %6
%18 = load float, float* %7
%19 = fdiv float %17, %18
store float %19, float* %8
%20 = load float, float* %8
store float %20, float* %5
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to float
%23 = load float, float* %6
%24 = fmul float %23, %22
store float %24, float* %6
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to float
%27 = load float, float* %7
%28 = fmul float %27, %26
store float %28, float* %7
br label %29
29: ; preds = %16
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %13
32: ; preds = %13
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %34)
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [21 x i8] c"X degerini giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Toplam = %.4f\0A\00"
define i32 @exponant(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to float
%7 = fmul float %6, %6
%8 = fmul float %7, %6
%9 = fmul float %8, %6
%10 = fmul float %9, %6
%11 = fmul float %10, %6
%12 = fmul float %11, %6
%13 = fmul float %12, %6
%14 = fmul float %13, %6
%15 = fdiv float %14, 3.628800e+05
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %16)
ret i32 undef
}