// File: /workspace/github_cpp_makefile_star2_O2/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, %r15d
movl %ecx, %ebp
movl %edx, %ebx
movl %edx, %eax
shlq $0x2, %rax
testl %edx, %edx
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x3030
movq %rax, %r14
cmpl $0x2, %r15d
ja 0xa529
movl %r15d, %eax
leaq 0x910b(%rip), %rcx      # 0x13614
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
leaq 0x230(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl %ebx, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x34e0
leaq 0x28(%rsp), %r15
leaq 0x230(%rsp), %rsi
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x35d0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0xa58b
movq 0x11a61(%rip), %rdi     # 0x1bfc8
leaq 0x9070(%rip), %rsi      # 0x135de
callq 0x3360
leaq 0x230(%rsp), %rsi
movq %rax, %rdi
callq 0x3360
movq %rax, %rdi
callq 0x3190
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
leaq 0x338(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x30a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xa64b
cmpl %ebx, %ebp
je 0xa64b
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
xorl %esi, %esi
callq 0x3560
movq %r13, %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x3540
movq 0x338(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
xorl %esi, %esi
callq 0x3560
movslq %ebp, %rax
leaq (%r14,%rax,4), %rsi
movq %r13, %rdi
callq 0x31f0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x48(%rsp,%rax)
je 0xa63c
movq 0x119ac(%rip), %rdi     # 0x1bfc8
leaq 0x8fd5(%rip), %rsi      # 0x135f8
callq 0x3360
movq %rax, %rdi
movl %ebp, %esi
callq 0x3580
movq %rax, %rdi
callq 0x3190
jmp 0xa63e
incl %ebp
movq %r13, %rdi
callq 0x3170
jmp 0xa59a
leaq 0x8(%rsp), %rdi
callq 0x3160
leaq 0x28(%rsp), %rdi
callq 0x30e0
movq %r14, %rax
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa678
jmp 0xa678
movq %rax, %rbx
jmp 0xa68d
movq %rax, %rbx
leaq 0x338(%rsp), %rdi
callq 0x3170
leaq 0x8(%rsp), %rdi
callq 0x3160
leaq 0x28(%rsp), %rdi
callq 0x30e0
movq %rbx, %rdi
callq 0x3590
nop