#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(void) {
  extern int nodes, streams;
  double arrivalRate = 75.0;
  double servTime1 = 0.100;
  double servTime2 = 0.200;
  int nthreadsA = 15;
  int nthreadsB = 30;
  int nthreadsC = 15;
  PDQ_Init("Triple MSQ Test");
  nodes = PDQ_CreateNode("mServerA", nthreadsA, 6);
  nodes = PDQ_CreateNode("mServerB", nthreadsB, 6);
  nodes = PDQ_CreateNode("mServerC", nthreadsC, 6);
  streams = PDQ_CreateOpen("Workflow", arrivalRate);
  PDQ_SetDemand("mServerA", "Workflow", servTime1);
  PDQ_SetDemand("mServerB", "Workflow", servTime2);
  PDQ_SetDemand("mServerC", "Workflow", servTime1);
  PDQ_Solve(16);
  PDQ_Report();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe8b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe76(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0xf,-0x1c(%rbp)
movl   $0x1e,-0x20(%rbp)
movl   $0xf,-0x24(%rbp)
lea    0xe6d(%rip),%rdi
call   1080 <PDQ_Init@plt>
mov    -0x1c(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,%ecx
mov    0x2e13(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,%ecx
mov    0x2df4(%rip),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,%ecx
mov    0x2dd5(%rip),%rax
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm0
lea    0xe2a(%rip),%rdi
call   1070 <PDQ_CreateOpen@plt>
mov    %eax,%ecx
mov    0x2dc1(%rip),%rax
mov    %ecx,(%rax)
movsd  -0x10(%rbp),%xmm0
lea    0xdf3(%rip),%rdi
lea    0xe07(%rip),%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xde4(%rip),%rdi
lea    0xdef(%rip),%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xdd5(%rip),%rdi
lea    0xdd7(%rip),%rsi
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    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea9(%rip),%rdi
call   1080 <PDQ_Init@plt>
lea    0xead(%rip),%r14
mov    %r14,%rdi
mov    $0xf,%esi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    0x2e4c(%rip),%rbx
mov    %eax,(%rbx)
lea    0xe94(%rip),%r15
mov    %r15,%rdi
mov    $0x1e,%esi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,(%rbx)
lea    0xe82(%rip),%r12
mov    %r12,%rdi
mov    $0xf,%esi
mov    $0x6,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,(%rbx)
lea    0xe70(%rip),%rbx
movsd  0xe25(%rip),%xmm0
mov    %rbx,%rdi
call   1070 <PDQ_CreateOpen@plt>
mov    0x2dfe(%rip),%rcx
mov    %eax,(%rcx)
movsd  0xe14(%rip),%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xe09(%rip),%xmm0
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <PDQ_SetDemand@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
movsd  0xde8(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
mov    $0x10,%edi
call   1060 <PDQ_Solve@plt>
xor    %eax,%eax
call   1030 <PDQ_Report@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Triple MSQ Test\00"
@.str.1 = [9 x i8] c"mServerA\00"
@nodes = external global i32
@.str.2 = [9 x i8] c"mServerB\00"
@.str.3 = [9 x i8] c"mServerC\00"
@.str.4 = [9 x i8] c"Workflow\00"
@streams = external global i32
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store double 7.500000e+01, double* %1
store double 1.000000e-01, double* %2
store double 2.000000e-01, double* %3
store i32 15, i32* %4
store i32 30, i32* %5
store i32 15, i32* %6
%7 = call i32 @PDQ_Init(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 6)
store i32 %9, i32* @nodes
%10 = load i32, i32* %5
%11 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 6)
store i32 %11, i32* @nodes
%12 = load i32, i32* %6
%13 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 6)
store i32 %13, i32* @nodes
%14 = load double, double* %1
%15 = call i32 @PDQ_CreateOpen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %14)
store i32 %15, i32* @streams
%16 = load double, double* %2
%17 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %16)
%18 = load double, double* %3
%19 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = load double, double* %2
%21 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %20)
%22 = call i32 @PDQ_Solve(i32 16)
%23 = call i32 (...) @PDQ_Report()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Triple MSQ Test\00"
@.str.1 = [9 x i8] c"mServerA\00"
@nodes = external global i32
@.str.2 = [9 x i8] c"mServerB\00"
@.str.3 = [9 x i8] c"mServerC\00"
@.str.4 = [9 x i8] c"Workflow\00"
@streams = external global i32
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_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 15, i32 6)
store i32 %2, i32* @nodes
%3 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 30, i32 6)
store i32 %3, i32* @nodes
%4 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 15, i32 6)
store i32 %4, i32* @nodes
%5 = tail call i32 @PDQ_CreateOpen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double 7.500000e+01)
store i32 %5, i32* @streams
%6 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double 1.000000e-01)
%7 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double 2.000000e-01)
%8 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double 1.000000e-01)
%9 = tail call i32 @PDQ_Solve(i32 16)
%10 = tail call i32 (...) @PDQ_Report()
ret i32 0
}