#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*/ getch();
int /*<<< orphan*/ printf(char *, double, int, double);
double xdistribution(double, int);
main() {
  int n;
  for (n = 1; n <= 5; n++) {
    printf("\nxdistribution(%4.2f,%d)=%e", 0.5 * n, n,
           xdistribution(0.5 * n, n));
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     11aa <main+0x7a>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xea3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe87(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%edi
call   1030 <xdistribution@plt>
mov    -0x14(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xec7(%rip),%xmm0
mov    $0x1,%edi
call   1030 <xdistribution@plt>
movaps %xmm0,%xmm1
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
movsd  0xea8(%rip),%xmm0
mov    $0x1,%esi
call   1040 <printf@plt>
movsd  0xe9e(%rip),%xmm0
mov    $0x2,%edi
call   1030 <xdistribution@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe86(%rip),%xmm0
mov    $0x2,%esi
call   1040 <printf@plt>
movsd  0xe7c(%rip),%xmm0
mov    $0x3,%edi
call   1030 <xdistribution@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe64(%rip),%xmm0
mov    $0x3,%esi
call   1040 <printf@plt>
movsd  0xe5a(%rip),%xmm0
mov    $0x4,%edi
call   1030 <xdistribution@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe42(%rip),%xmm0
mov    $0x4,%esi
call   1040 <printf@plt>
movsd  0xe38(%rip),%xmm0
mov    $0x5,%edi
call   1030 <xdistribution@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe20(%rip),%xmm0
mov    $0x5,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"\0Axdistribution(%4.2f,%d)=%e\00"
define i32 @main() {
%1 = tail call double @xdistribution(double 5.000000e-01, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 5.000000e-01, i32 1, double %1)
%3 = tail call double @xdistribution(double 1.000000e+00, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, i32 2, double %3)
%5 = tail call double @xdistribution(double 1.500000e+00, i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 1.500000e+00, i32 3, double %5)
%7 = tail call double @xdistribution(double 2.000000e+00, i32 4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 2.000000e+00, i32 4, double %7)
%9 = tail call double @xdistribution(double 2.500000e+00, i32 5)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 2.500000e+00, i32 5, double %9)
%11 = tail call i32 (...) @getch()
ret i32 0
}