// File: /workspace/github_cpp_makefile_star2_O3/dtsaras[P]GCW/Utilities.cpp
// Function: Utilities::readBudgetsFromFile(int, int, int, int)
int* Utilities::readBudgetsFromFile(int V, int P, int k, int run_program)
{   
    int* budgets;
    budgets = new int[P];
    char filename[256]; 
    
    
    
    if (run_program==0)
    snprintf(filename, sizeof(char) * 256, "/home/lefteris/stcpu2/entaflos/CIM_Create_Budgets/Test/P=%i/file%i.txt", P, k);


    if (run_program==1)
        snprintf(filename, sizeof(char) * 256, "/home/lefteris/stcpu2/entaflos/CIM_Create_Budgets/Gowalla/P=%i/file%i.txt", P, k);


    if (run_program==2)
        snprintf(filename, sizeof(char) * 256, "/home/lefteris/stcpu2/entaflos/CIM_Create_Budgets/Foursquare/P=%i/file%i.txt", P, k);

    
    ifstream fin(filename);
    string line;   

    if (! fin)
        cout << "Cannot open budgets file " << filename << endl;
        
    
    int p=0;
    while(getline(fin, line))
    { 
        if(p==P) break;
        fin.clear();
        std::istringstream iss(line);
        iss.clear();
        iss >> budgets[p];
        if (! fin.good())
        {
            cout << "fin is not good: event = " << p << endl;
            continue;
        }
        p++;
    }
   
   
   
   return budgets;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movl %r8d, %r14d
movl %ecx, %ebx
movl %edx, %ebp
movl %edx, %eax
shlq $0x2, %rax
testl %edx, %edx
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x3030
movq %rax, (%rsp)
cmpl $0x2, %r14d
ja 0xc6fa
movl %r14d, %eax
leaq 0xaf9a(%rip), %rcx      # 0x17674
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
leaq 0x3b0(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl %ebp, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x3510
leaq 0x28(%rsp), %r14
leaq 0x3b0(%rsp), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x3610
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0xc79e
movq 0x11893(%rip), %rdi     # 0x1dfd0
leaq 0xaefa(%rip), %rsi      # 0x1763e
movl $0x19, %edx
callq 0x33b0
leaq 0x3b0(%rsp), %r15
movq %r15, %rdi
callq 0x3160
movq 0x1186b(%rip), %rbx     # 0x1dfd0
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x33b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3360
movsbl %al, %esi
movq 0x1183f(%rip), %rdi     # 0x1dfd0
callq 0x3040
movq %rax, %rdi
callq 0x3240
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
leaq 0x230(%rsp), %r15
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3360
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3620
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xc8c0
cmpl %ebp, %r12d
je 0xc8c0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
xorl %esi, %esi
callq 0x3590
movq %r15, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x3570
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
xorl %esi, %esi
callq 0x3590
movslq %r12d, %rax
movq (%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %r15, %rdi
callq 0x31e0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x48(%rsp,%rax)
je 0xc89c
movl $0x19, %edx
movq 0x1177b(%rip), %rdi     # 0x1dfd0
leaq 0xadfc(%rip), %rsi      # 0x17658
callq 0x33b0
movq 0x11768(%rip), %rdi     # 0x1dfd0
movl %r12d, %esi
callq 0x35b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3240
jmp 0xc89f
incl %r12d
movq %r15, %rdi
movq 0x1171f(%rip), %rsi     # 0x1dfc8
callq 0x3470
leaq 0x2a8(%rsp), %rdi
callq 0x3120
jmp 0xc7ae
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xc8d4
callq 0x3340
leaq 0x28(%rsp), %rdi
callq 0x30d0
movq (%rsp), %rax
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc8f8
jmp 0xc8f8
movq %rax, %rbx
jmp 0xc921
movq %rax, %rbx
movq 0x116c1(%rip), %rsi     # 0x1dfc8
leaq 0x230(%rsp), %rdi
callq 0x3470
leaq 0x2a8(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xc935
callq 0x3340
leaq 0x28(%rsp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x35c0
nop