// File: /workspace/github_cpp_makefile_star2_O1/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
movslq %edx, %rax
leaq (,%rax,4), %rcx
testl %eax, %eax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x3030
movq %rax, (%rsp)
cmpl $0x2, %r14d
ja 0xc87f
movl %r14d, %eax
leaq 0xbe15(%rip), %rcx      # 0x18674
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 0xc923
movq 0x1270e(%rip), %rdi     # 0x1efd0
leaq 0xbd75(%rip), %rsi      # 0x1863e
movl $0x19, %edx
callq 0x33b0
leaq 0x3b0(%rsp), %r15
movq %r15, %rdi
callq 0x3160
movq 0x126e6(%rip), %rbx     # 0x1efd0
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 0x126ba(%rip), %rdi     # 0x1efd0
callq 0x3040
movq %rax, %rdi
callq 0x3240
xorl %r15d, %r15d
leaq 0x8(%rsp), %r13
leaq 0x230(%rsp), %r12
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 0xca45
cmpl %ebp, %r15d
je 0xca45
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
xorl %esi, %esi
callq 0x3590
movq %r12, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x3570
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
xorl %esi, %esi
callq 0x3590
movslq %r15d, %rax
movq (%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %r12, %rdi
callq 0x31e0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x48(%rsp,%rax)
je 0xca21
movl $0x19, %edx
movq 0x125f6(%rip), %rdi     # 0x1efd0
leaq 0xbc77(%rip), %rsi      # 0x18658
callq 0x33b0
movq 0x125e3(%rip), %rdi     # 0x1efd0
movl %r15d, %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 0xca24
incl %r15d
movq %r12, %rdi
movq 0x1259a(%rip), %rsi     # 0x1efc8
callq 0x3470
leaq 0x2a8(%rsp), %rdi
callq 0x3120
jmp 0xc933
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xca59
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 0xca7d
jmp 0xca7d
movq %rax, %rbx
jmp 0xcaa6
movq %rax, %rbx
movq 0x1253c(%rip), %rsi     # 0x1efc8
leaq 0x230(%rsp), %rdi
callq 0x3470
leaq 0x2a8(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xcaba
callq 0x3340
leaq 0x28(%rsp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x35c0