#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 */
double beta(double, double, int);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int n;
  for (n = 0; n < 4; n++) {
    printf("\nbeta(0.5,2.0,%4.2f)=%2.5f", (n + 1) * 0.2,
           beta(0.5, 2.0, (n + 1) * 0.2));
  }
  printf("\n");
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11be <main+0x8e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xeae(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe93(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe73(%rip),%xmm0
movsd  0xe73(%rip),%xmm1
call   1040 <beta@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
lea    0xe6f(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xeb7(%rip),%xmm0
movsd  0xeb7(%rip),%xmm1
xor    %edi,%edi
call   1050 <beta@plt>
movaps %xmm0,%xmm1
lea    0xece(%rip),%rbx
movsd  0xea6(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe84(%rip),%xmm0
movsd  0xe84(%rip),%xmm1
xor    %edi,%edi
call   1050 <beta@plt>
movaps %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe58(%rip),%xmm0
movsd  0xe58(%rip),%xmm1
xor    %edi,%edi
call   1050 <beta@plt>
movaps %xmm0,%xmm1
movsd  0xe5e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe2c(%rip),%xmm0
movsd  0xe2c(%rip),%xmm1
xor    %edi,%edi
call   1050 <beta@plt>
movaps %xmm0,%xmm1
movsd  0xe3a(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0Abeta(0.5,2.0,%4.2f)=%2.5f\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 2.000000e-01
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 2.000000e-01
%15 = fptosi double %14 to i32
%16 = call double @beta(double 5.000000e-01, double 2.000000e+00, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %10, double %16)
br label %18
18: ; preds = %6
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %3
21: ; preds = %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (...) @getch()
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0Abeta(0.5,2.0,%4.2f)=%2.5f\00"
define i32 @main() {
%1 = tail call double @beta(double 5.000000e-01, double 2.000000e+00, i32 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double 2.000000e-01, double %1)
%3 = tail call double @beta(double 5.000000e-01, double 2.000000e+00, i32 0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double 4.000000e-01, double %3)
%5 = tail call double @beta(double 5.000000e-01, double 2.000000e+00, i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double 0x3FE3333333333334, double %5)
%7 = tail call double @beta(double 5.000000e-01, double 2.000000e+00, i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double 8.000000e-01, double %7)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 (...) @getch()
ret i32 0
}