#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 atof(char *);
long atol(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
main(int argc, char *argv[]) {
  double erlangB;
  double erlangC;
  double traffic;
  double eb;
  double rho;
  double nrt;
  double ql;
  long m;
  long servers;
  if (argc < 3) {
    printf("Usage: %s servers traffic\n", argv[0]);
    printf("NOTE:Per server load = traffic/servers\n");
    exit(1);
  }
  servers = atol(*++argv);
  traffic = atof(*++argv);
  rho = traffic / servers;
  erlangB = traffic / (1 + traffic);
  for (m = 2; m <= servers; m++) {
    eb = erlangB;
    erlangB = eb * traffic / (m + eb * traffic);
  }
  erlangC = erlangB / (1 - rho + rho * erlangB);
  nrt = 1 + erlangC / (servers * (1 - rho));
  ql = traffic * nrt;
  printf("  %ld Server System\n", servers);
  printf("  -----------------\n");
  printf("  Traffic intensity:  %5.5lf\n", traffic);
  printf("  Server utilization: %5.5lf\n", rho);
  printf("  \n");
  printf("  Erlang B  (loss  prob): %5.5lf\n", erlangB);
  printf("  Erlang C  (queue prob): %5.5lf\n", erlangC);
  printf("  M/M/m    Normalized RT: %5.5lf\n", nrt);
  printf("  M/M/m    No. in System: %5.5lf\n", ql);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    118d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdq -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe19(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x2,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x58(%rbp),%rax
jg     1251 <main+0x111>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvtsi2sdq -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    11fd <main+0xbd>
movsd  -0x18(%rbp),%xmm0
movsd  0xda2(%rip),%xmm2
subsd  -0x38(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdq -0x58(%rbp),%xmm0
movsd  0xd6f(%rip),%xmm2
subsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xd5a(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xd8b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xd96(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xda6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xdb5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xdc4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jle    1327 <main+0x1d7>
mov    0x8(%rbx),%rdi
call   1060 <atol@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
cvtsi2sd %r14,%xmm5
movapd %xmm0,%xmm3
divsd  %xmm5,%xmm3
movsd  0xe73(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm0,%xmm4
divsd  %xmm1,%xmm4
cmp    $0x2,%r14
jl     1220 <main+0xd0>
lea    -0x1(%r14),%rax
cmp    $0x2,%r14
jne    11bb <main+0x6b>
movsd  0xe53(%rip),%xmm1
test   $0x1,%al
jne    1214 <main+0xc4>
jmp    1220 <main+0xd0>
mov    %rax,%rcx
and    $0xfffffffffffffffe,%rcx
mov    $0x2,%edx
nopw   0x0(%rax,%rax,1)
mov    %rdx,%rsi
mulsd  %xmm0,%xmm4
xorps  %xmm1,%xmm1
cvtsi2sd %rdx,%xmm1
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm4
add    $0x1,%rdx
xorps  %xmm1,%xmm1
cvtsi2sd %rdx,%xmm1
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm4
lea    0x2(%rsi),%rdx
cmp    %rcx,%rsi
jne    11d0 <main+0x80>
xorps  %xmm1,%xmm1
cvtsi2sd %rdx,%xmm1
test   $0x1,%al
je     1220 <main+0xd0>
mulsd  %xmm0,%xmm4
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm4
movsd  %xmm4,0x10(%rsp)
movsd  0xdd2(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm3,%xmm2
movsd  %xmm3,0x18(%rsp)
mulsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm4,%xmm6
divsd  %xmm3,%xmm6
movsd  %xmm6,0x20(%rsp)
mulsd  %xmm5,%xmm2
movapd %xmm6,%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x28(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x30(%rsp)
lea    0xdae(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
lea    0xda0(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdaa(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
lea    0xda8(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdb6(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdc4(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdd2(%rip),%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret
mov    (%rbx),%rsi
lea    0xcdf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xddc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Usage: %s servers traffic\0A\00"
@.str.1 = [40 x i8] c"NOTE:Per server load = traffic/servers\0A\00"
@.str.2 = [21 x i8] c" %ld Server System\0A\00"
@.str.3 = [21 x i8] c" -----------------\0A\00"
@.str.4 = [30 x i8] c" Traffic intensity: %5.5lf\0A\00"
@.str.5 = [30 x i8] c" Server utilization: %5.5lf\0A\00"
@.str.6 = [4 x i8] c" \0A\00"
@.str.7 = [34 x i8] c" Erlang B (loss prob): %5.5lf\0A\00"
@.str.8 = [34 x i8] c" Erlang C (queue prob): %5.5lf\0A\00"
@.str.9 = [34 x i8] c" M/M/m Normalized RT: %5.5lf\0A\00"
@.str.10 = [34 x i8] c" M/M/m No. in System: %5.5lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i64
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i8*, i8** %26
%28 = call i64 @atol(i8* %27)
store i64 %28, i64* %14
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i32 1
store i8** %30, i8*** %5
%31 = load i8*, i8** %30
%32 = call double @atof(i8* %31)
store double %32, double* %8
%33 = load double, double* %8
%34 = load i64, i64* %14
%35 = sitofp i64 %34 to double
%36 = fdiv double %33, %35
store double %36, double* %10
%37 = load double, double* %8
%38 = load double, double* %8
%39 = fadd double 1.000000e+00, %38
%40 = fdiv double %37, %39
store double %40, double* %6
store i64 2, i64* %13
br label %41
41: ; preds = %56, %24
%42 = load i64, i64* %13
%43 = load i64, i64* %14
%44 = icmp sle i64 %42, %43
br i1 %44, label %45, label %59
45: ; preds = %41
%46 = load double, double* %6
store double %46, double* %9
%47 = load double, double* %9
%48 = load double, double* %8
%49 = fmul double %47, %48
%50 = load i64, i64* %13
%51 = sitofp i64 %50 to double
%52 = load double, double* %9
%53 = load double, double* %8
%54 = call double @llvm.fmuladd.f64(double %52, double %53, double %51)
%55 = fdiv double %49, %54
store double %55, double* %6
br label %56
56: ; preds = %45
%57 = load i64, i64* %13
%58 = add nsw i64 %57, 1
store i64 %58, i64* %13
br label %41
59: ; preds = %41
%60 = load double, double* %6
%61 = load double, double* %10
%62 = fsub double 1.000000e+00, %61
%63 = load double, double* %10
%64 = load double, double* %6
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double %62)
%66 = fdiv double %60, %65
store double %66, double* %7
%67 = load double, double* %7
%68 = load i64, i64* %14
%69 = sitofp i64 %68 to double
%70 = load double, double* %10
%71 = fsub double 1.000000e+00, %70
%72 = fmul double %69, %71
%73 = fdiv double %67, %72
%74 = fadd double 1.000000e+00, %73
store double %74, double* %11
%75 = load double, double* %8
%76 = load double, double* %11
%77 = fmul double %75, %76
store double %77, double* %12
%78 = load i64, i64* %14
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i64 %78)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%81 = load double, double* %8
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %81)
%83 = load double, double* %10
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %83)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%86 = load double, double* %6
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), double %86)
%88 = load double, double* %7
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %88)
%90 = load double, double* %11
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %90)
%92 = load double, double* %12
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), double %92)
%94 = load i32, i32* %3
ret i32 %94
}

LLVM IR (-O2):
@.str = [27 x i8] c"Usage: %s servers traffic\0A\00"
@.str.2 = [21 x i8] c" %ld Server System\0A\00"
@.str.4 = [30 x i8] c" Traffic intensity: %5.5lf\0A\00"
@.str.5 = [30 x i8] c" Server utilization: %5.5lf\0A\00"
@.str.7 = [34 x i8] c" Erlang B (loss prob): %5.5lf\0A\00"
@.str.8 = [34 x i8] c" Erlang C (queue prob): %5.5lf\0A\00"
@.str.9 = [34 x i8] c" M/M/m Normalized RT: %5.5lf\0A\00"
@.str.10 = [34 x i8] c" M/M/m No. in System: %5.5lf\0A\00"
@str = [20 x i8] c" -----------------\00"
@str.11 = [3 x i8] c" \00"
@str.12 = [39 x i8] c"NOTE:Per server load = traffic/servers\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @atol(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call double @atof(i8* %14)
%16 = sitofp i64 %12 to double
%17 = fdiv double %15, %16
%18 = fadd double %15, 1.000000e+00
%19 = fdiv double %15, %18
%20 = icmp slt i64 %12, 2
br i1 %20, label %54, label %21
21: ; preds = %9
%22 = add i64 %12, -1
%23 = and i64 %22, 1
%24 = icmp eq i64 %12, 2
br i1 %24, label %45, label %25
25: ; preds = %21
%26 = and i64 %22, -2
br label %27
27: ; preds = %27, %25
%28 = phi i64 [ 2, %25 ], [ %40, %27 ]
%29 = phi double [ %19, %25 ], [ %39, %27 ]
%30 = phi i64 [ 0, %25 ], [ %41, %27 ]
%31 = fmul double %15, %29
%32 = sitofp i64 %28 to double
%33 = tail call double @llvm.fmuladd.f64(double %29, double %15, double %32)
%34 = fdiv double %31, %33
%35 = or i64 %28, 1
%36 = fmul double %15, %34
%37 = sitofp i64 %35 to double
%38 = tail call double @llvm.fmuladd.f64(double %34, double %15, double %37)
%39 = fdiv double %36, %38
%40 = add nuw i64 %28, 2
%41 = add i64 %30, 2
%42 = icmp eq i64 %41, %26
br i1 %42, label %43, label %27
43: ; preds = %27
%44 = sitofp i64 %40 to double
br label %45
45: ; preds = %43, %21
%46 = phi double [ undef, %21 ], [ %39, %43 ]
%47 = phi double [ 2.000000e+00, %21 ], [ %44, %43 ]
%48 = phi double [ %19, %21 ], [ %39, %43 ]
%49 = icmp eq i64 %23, 0
br i1 %49, label %54, label %50
50: ; preds = %45
%51 = fmul double %15, %48
%52 = tail call double @llvm.fmuladd.f64(double %48, double %15, double %47)
%53 = fdiv double %51, %52
br label %54
54: ; preds = %50, %45, %9
%55 = phi double [ %19, %9 ], [ %46, %45 ], [ %53, %50 ]
%56 = fsub double 1.000000e+00, %17
%57 = tail call double @llvm.fmuladd.f64(double %17, double %55, double %56)
%58 = fdiv double %55, %57
%59 = fmul double %56, %16
%60 = fdiv double %58, %59
%61 = fadd double %60, 1.000000e+00
%62 = fmul double %15, %61
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i64 %12)
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %15)
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %17)
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.11, i64 0, i64 0))
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), double %55)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %58)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %61)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), double %62)
ret i32 0
}