#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 PDQ_CreateNode(char *, int, int);
int PDQ_CreateOpen(char *, double);
int /*<<< orphan*/ PDQ_Init(char *);
int /*<<< orphan*/ PDQ_Report();
int /*<<< orphan*/ PDQ_SetDemand(char *, char *, double);
int /*<<< orphan*/ PDQ_Solve(int);
int main() {
  int numStreams;
  int numNodes;
  double arrivals = 15.36 / 3600;
  double p12 = 0.30;
  double p13 = 0.70;
  double p23 = 0.20;
  double p32 = 0.10;
  double v3 = (p13 + p23 * p12) / (1 - p23 * p32);
  double v2 = p12 + p32 * v3;
  PDQ_Init("Passport Office");
  numStreams = PDQ_CreateOpen("Applicant", arrivals);
  numNodes = PDQ_CreateNode("Window1", 4, 8);
  numNodes = PDQ_CreateNode("Window2", 4, 8);
  numNodes = PDQ_CreateNode("Window3", 4, 8);
  numNodes = PDQ_CreateNode("Window4", 4, 8);
  PDQ_SetDemand("Window1", "Applicant", 20.0);
  PDQ_SetDemand("Window2", "Applicant", 600.0 * v2);
  PDQ_SetDemand("Window3", "Applicant", 300.0 * v3);
  PDQ_SetDemand("Window4", "Applicant", 60.0);
  PDQ_Solve(16);
  PDQ_Report();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe92(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe2c(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    0xe2c(%rip),%rdi
call   1080 <PDQ_Init@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe2b(%rip),%rdi
call   1070 <PDQ_CreateOpen@plt>
mov    %eax,-0x8(%rbp)
lea    0xe26(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0xc(%rbp)
lea    0xe15(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0xc(%rbp)
lea    0xe04(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0xc(%rbp)
lea    0xdf3(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0xc(%rbp)
lea    0xdc2(%rip),%rdi
lea    0xdb1(%rip),%rsi
movsd  0xd61(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
movsd  0xd4c(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
lea    0xda2(%rip),%rdi
lea    0xd89(%rip),%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xd24(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
lea    0xd8a(%rip),%rdi
lea    0xd69(%rip),%rsi
call   1050 <PDQ_SetDemand@plt>
lea    0xd7f(%rip),%rdi
lea    0xd56(%rip),%rsi
movsd  0xcee(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
mov    $0x10,%edi
call   1060 <PDQ_Solve@plt>
mov    $0x0,%al
call   1030 <PDQ_Report@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xeb8(%rip),%rdi
call   1080 <PDQ_Init@plt>
lea    0xebc(%rip),%rbx
movsd  0xe7c(%rip),%xmm0
mov    %rbx,%rdi
call   1070 <PDQ_CreateOpen@plt>
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
lea    0xe9e(%rip),%r15
mov    %r15,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
lea    0xe8d(%rip),%r12
mov    %r12,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
lea    0xe7c(%rip),%r13
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
movsd  0xe10(%rip),%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xe05(%rip),%xmm0
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdfa(%rip),%xmm0
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdef(%rip),%xmm0
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
mov    $0x10,%edi
call   1060 <PDQ_Solve@plt>
xor    %eax,%eax
call   1030 <PDQ_Report@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Passport Office\00"
@.str.1 = [10 x i8] c"Applicant\00"
@.str.2 = [8 x i8] c"Window1\00"
@.str.3 = [8 x i8] c"Window2\00"
@.str.4 = [8 x i8] c"Window3\00"
@.str.5 = [8 x i8] c"Window4\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
store double 0x3F7179EC9CBD821E, double* %4
store double 3.000000e-01, double* %5
store double 0x3FE6666666666666, double* %6
store double 2.000000e-01, double* %7
store double 1.000000e-01, double* %8
%11 = load double, double* %6
%12 = load double, double* %7
%13 = load double, double* %5
%14 = call double @llvm.fmuladd.f64(double %12, double %13, double %11)
%15 = load double, double* %7
%16 = load double, double* %8
%17 = fneg double %15
%18 = call double @llvm.fmuladd.f64(double %17, double %16, double 1.000000e+00)
%19 = fdiv double %14, %18
store double %19, double* %9
%20 = load double, double* %5
%21 = load double, double* %8
%22 = load double, double* %9
%23 = call double @llvm.fmuladd.f64(double %21, double %22, double %20)
store double %23, double* %10
%24 = call i32 @PDQ_Init(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%25 = load double, double* %4
%26 = call i32 @PDQ_CreateOpen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %25)
store i32 %26, i32* %2
%27 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 8)
store i32 %27, i32* %3
%28 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 8)
store i32 %28, i32* %3
%29 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
store i32 %29, i32* %3
%30 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 8)
store i32 %30, i32* %3
%31 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+01)
%32 = load double, double* %10
%33 = fmul double 6.000000e+02, %32
%34 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %33)
%35 = load double, double* %9
%36 = fmul double 3.000000e+02, %35
%37 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %36)
%38 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 6.000000e+01)
%39 = call i32 @PDQ_Solve(i32 16)
%40 = call i32 (...) @PDQ_Report()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Passport Office\00"
@.str.1 = [10 x i8] c"Applicant\00"
@.str.2 = [8 x i8] c"Window1\00"
@.str.3 = [8 x i8] c"Window2\00"
@.str.4 = [8 x i8] c"Window3\00"
@.str.5 = [8 x i8] c"Window4\00"
define i32 @main() {
%1 = tail call i32 @PDQ_Init(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @PDQ_CreateOpen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 0x3F7179EC9CBD821E)
%3 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 8)
%4 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 8)
%5 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
%6 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 8)
%7 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+01)
%8 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 0x406C50FAC687D634)
%9 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 0x406D14E5E0A72F05)
%10 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 6.000000e+01)
%11 = tail call i32 @PDQ_Solve(i32 16)
%12 = tail call i32 (...) @PDQ_Report()
ret i32 0
}