#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_CreateClosed(char *, int, double, double);
int PDQ_CreateNode(char *, int, int);
int /*<<< orphan*/ PDQ_Init(char *);
int /*<<< orphan*/ PDQ_Report();
int /*<<< orphan*/ PDQ_SetDemand(char *, char *, double);
int /*<<< orphan*/ PDQ_Solve(int);
int main() {
  int noNodes;
  int noStreams;
  PDQ_Init("Multiclass Test");
  noStreams = PDQ_CreateClosed("term1", 11, 5.0, 20.0);
  noStreams = PDQ_CreateClosed("term2", 11, 15.0, 30.0);
  noStreams = PDQ_CreateClosed("batch", 13, 5.0, 0.0);
  noNodes = PDQ_CreateNode("node1", 4, 8);
  noNodes = PDQ_CreateNode("node2", 4, 8);
  noNodes = PDQ_CreateNode("node3", 4, 8);
  PDQ_SetDemand("node1", "term1", 0.50);
  PDQ_SetDemand("node1", "term2", 0.04);
  PDQ_SetDemand("node1", "batch", 0.06);
  PDQ_SetDemand("node2", "term1", 0.40);
  PDQ_SetDemand("node2", "term2", 0.20);
  PDQ_SetDemand("node2", "batch", 0.30);
  PDQ_SetDemand("node3", "term1", 1.20);
  PDQ_SetDemand("node3", "term2", 0.05);
  PDQ_SetDemand("node3", "batch", 0.06);
  PDQ_Solve(14);
  PDQ_Report();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
call   1080 <PDQ_Init@plt>
lea    0xeee(%rip),%rdi
mov    $0xb,%esi
movsd  0xeb1(%rip),%xmm0
movsd  0xec1(%rip),%xmm1
call   1070 <PDQ_CreateClosed@plt>
mov    %eax,-0xc(%rbp)
lea    0xed0(%rip),%rdi
mov    $0xb,%esi
movsd  0xe95(%rip),%xmm0
movsd  0xe95(%rip),%xmm1
call   1070 <PDQ_CreateClosed@plt>
mov    %eax,-0xc(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0xd,%esi
movsd  0xe69(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1070 <PDQ_CreateClosed@plt>
mov    %eax,-0xc(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0x8(%rbp)
lea    0xe86(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0x8(%rbp)
lea    0xe73(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
mov    %eax,-0x8(%rbp)
lea    0xe4e(%rip),%rdi
lea    0xe35(%rip),%rsi
movsd  0xdf5(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xe33(%rip),%rdi
lea    0xe20(%rip),%rsi
movsd  0xdd2(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xe18(%rip),%rdi
lea    0xe0b(%rip),%rsi
movsd  0xd87(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xe03(%rip),%rdi
lea    0xde4(%rip),%rsi
movsd  0xd94(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xde8(%rip),%rdi
lea    0xdcf(%rip),%rsi
movsd  0xd71(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xdcd(%rip),%rdi
lea    0xdba(%rip),%rsi
movsd  0xd4e(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xdb8(%rip),%rdi
lea    0xd93(%rip),%rsi
movsd  0xd2b(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xd9d(%rip),%rdi
lea    0xd7e(%rip),%rsi
movsd  0xd08(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
lea    0xd82(%rip),%rdi
lea    0xd69(%rip),%rsi
movsd  0xce5(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
mov    $0xe,%edi
call   1060 <PDQ_Solve@plt>
mov    $0x0,%al
call   1030 <PDQ_Report@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeee(%rip),%rdi
call   1080 <PDQ_Init@plt>
lea    0xef2(%rip),%r14
movsd  0xe7a(%rip),%xmm0
movsd  0xe7a(%rip),%xmm1
mov    %r14,%rdi
mov    $0xb,%esi
call   1070 <PDQ_CreateClosed@plt>
lea    0xed4(%rip),%r15
movsd  0xe66(%rip),%xmm0
movsd  0xe66(%rip),%xmm1
mov    %r15,%rdi
mov    $0xb,%esi
call   1070 <PDQ_CreateClosed@plt>
lea    0xeb6(%rip),%r12
xorps  %xmm1,%xmm1
mov    %r12,%rdi
mov    $0xd,%esi
movsd  0xe27(%rip),%xmm0
call   1070 <PDQ_CreateClosed@plt>
lea    0xe9d(%rip),%rbp
mov    %rbp,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
lea    0xe8a(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
lea    0xe77(%rip),%r13
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <PDQ_CreateNode@plt>
movsd  0xdef(%rip),%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xde4(%rip),%xmm0
mov    %rbp,%rdi
mov    %r15,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdd9(%rip),%xmm0
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdce(%rip),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdc3(%rip),%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdb8(%rip),%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xdad(%rip),%xmm0
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <PDQ_SetDemand@plt>
movsd  0xda2(%rip),%xmm0
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <PDQ_SetDemand@plt>
mov    %r13,%rdi
mov    %r12,%rsi
movsd  0xd61(%rip),%xmm0
call   1050 <PDQ_SetDemand@plt>
mov    $0xe,%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    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Multiclass Test\00"
@.str.1 = [6 x i8] c"term1\00"
@.str.2 = [6 x i8] c"term2\00"
@.str.3 = [6 x i8] c"batch\00"
@.str.4 = [6 x i8] c"node1\00"
@.str.5 = [6 x i8] c"node2\00"
@.str.6 = [6 x i8] c"node3\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @PDQ_Init(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @PDQ_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 11, double 5.000000e+00, double 2.000000e+01)
store i32 %5, i32* %3
%6 = call i32 @PDQ_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 11, double 1.500000e+01, double 3.000000e+01)
store i32 %6, i32* %3
%7 = call i32 @PDQ_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 13, double 5.000000e+00, double 0.000000e+00)
store i32 %7, i32* %3
%8 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
store i32 %8, i32* %2
%9 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 8)
store i32 %9, i32* %2
%10 = call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 4, i32 8)
store i32 %10, i32* %2
%11 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 5.000000e-01)
%12 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 4.000000e-02)
%13 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 6.000000e-02)
%14 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 4.000000e-01)
%15 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 2.000000e-01)
%16 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 3.000000e-01)
%17 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 1.200000e+00)
%18 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 5.000000e-02)
%19 = call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 6.000000e-02)
%20 = call i32 @PDQ_Solve(i32 14)
%21 = call i32 (...) @PDQ_Report()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Multiclass Test\00"
@.str.1 = [6 x i8] c"term1\00"
@.str.2 = [6 x i8] c"term2\00"
@.str.3 = [6 x i8] c"batch\00"
@.str.4 = [6 x i8] c"node1\00"
@.str.5 = [6 x i8] c"node2\00"
@.str.6 = [6 x i8] c"node3\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_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 11, double 5.000000e+00, double 2.000000e+01)
%3 = tail call i32 @PDQ_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 11, double 1.500000e+01, double 3.000000e+01)
%4 = tail call i32 @PDQ_CreateClosed(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 13, double 5.000000e+00, double 0.000000e+00)
%5 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
%6 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 8)
%7 = tail call i32 @PDQ_CreateNode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 4, i32 8)
%8 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 5.000000e-01)
%9 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 4.000000e-02)
%10 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 6.000000e-02)
%11 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 4.000000e-01)
%12 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 2.000000e-01)
%13 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 3.000000e-01)
%14 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double 1.200000e+00)
%15 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double 5.000000e-02)
%16 = tail call i32 @PDQ_SetDemand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 6.000000e-02)
%17 = tail call i32 @PDQ_Solve(i32 14)
%18 = tail call i32 (...) @PDQ_Report()
ret i32 0
}