// File: NishadSaraf[P]Championship-Simulator/inc/ooo_cpu.h
// Function: O3_CPU::O3_CPU()
O3_CPU() {
        cpu = 0;

        // trace
        trace_file = NULL;

        // instruction
        instr_unique_id = 0;
        completed_executions = 0;
        begin_sim_cycle = 0;
        begin_sim_instr = 0;
        last_sim_cycle = 0;
        last_sim_instr = 0;
        finish_sim_cycle = 0;
        finish_sim_instr = 0;
        warmup_instructions = 0;
        simulation_instructions = 0;
        instrs_to_read_this_cycle = 0;
        instrs_to_fetch_this_cycle = 0;

        next_print_instruction = STAT_PRINTING_PERIOD;
        num_retired = 0;

        inflight_reg_executions = 0;
        inflight_mem_executions = 0;
        num_searched = 0;

        next_ITLB_fetch = 0;

        // branch
        branch_mispredict_stall_fetch = 0;
        mispredicted_branch_iw_index = 0;
        fetch_stall = 0;
        num_branch = 0;
        branch_mispredictions = 0;

        for (uint32_t i=0; i<STA_SIZE; i++)
            STA[i] = UINT64_MAX;
        STA_head = 0;
        STA_tail = 0;

        for (uint32_t i=0; i<ROB_SIZE; i++) {
            RTE0[i] = ROB_SIZE;
            RTE1[i] = ROB_SIZE;
        }
        RTE0_head = 0;
        RTE1_head = 0;
        RTE0_tail = 0;
        RTE1_tail = 0;

        for (uint32_t i=0; i<LQ_SIZE; i++) {
            RTL0[i] = LQ_SIZE;
            RTL1[i] = LQ_SIZE;
        }
        RTL0_head = 0;
        RTL1_head = 0;
        RTL0_tail = 0;
        RTL1_tail = 0;

        for (uint32_t i=0; i<SQ_SIZE; i++) {
            RTS0[i] = SQ_SIZE;
            RTS1[i] = SQ_SIZE;
        }
        RTS0_head = 0;
        RTS1_head = 0;
        RTS0_tail = 0;
        RTS1_tail = 0;
    }

// Assembly:
subq $0x248, %rsp            # imm = 0x248
movq %rdi, 0x240(%rsp)
movq 0x240(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
addq $0x810, %rdi            # imm = 0x810
callq 0x1c710
movq 0xa0(%rsp), %rdi
addq $0x850, %rdi            # imm = 0x850
callq 0x1c7a0
movq 0xa0(%rsp), %rax
addq $0x930, %rax            # imm = 0x930
movq %rax, 0xa8(%rsp)
leaq 0x21f(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x33d0
movq 0xb0(%rsp), %rdx
leaq 0x8689(%rip), %rsi      # 0x23f22
leaq 0x220(%rsp), %rdi
callq 0x32e0
jmp 0x1b8a8
movq 0xa8(%rsp), %rdi
leaq 0x220(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x1c840
jmp 0x1b8c4
leaq 0x220(%rsp), %rdi
callq 0x3150
leaq 0x21f(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x9c0, %rax            # imm = 0x9C0
movq %rax, 0x90(%rsp)
leaq 0x1e7(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x33d0
movq 0x98(%rsp), %rdx
leaq 0x860e(%rip), %rsi      # 0x23f26
leaq 0x1e8(%rsp), %rdi
callq 0x32e0
jmp 0x1b927
movq 0x90(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
movl $0x48, %edx
callq 0x1c9c0
jmp 0x1b943
leaq 0x1e8(%rsp), %rdi
callq 0x3150
leaq 0x1e7(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x9f8, %rax            # imm = 0x9F8
movq %rax, 0x80(%rsp)
leaq 0x1bf(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x33d0
movq 0x88(%rsp), %rdx
leaq 0x8592(%rip), %rsi      # 0x23f29
leaq 0x1c0(%rsp), %rdi
callq 0x32e0
jmp 0x1b9a6
movq 0x80(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
movl $0x38, %edx
callq 0x1c9c0
jmp 0x1b9c2
leaq 0x1c0(%rsp), %rdi
callq 0x3150
leaq 0x1bf(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x3690, %rax           # imm = 0x3690
movq %rax, 0x70(%rsp)
leaq 0x197(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x33d0
movq 0x78(%rsp), %rdx
leaq 0x851f(%rip), %rsi      # 0x23f2c
leaq 0x198(%rsp), %rdi
callq 0x32e0
jmp 0x1ba1c
movq 0x70(%rsp), %rdi
movq %rsp, %rax
movl $0x8, 0x10(%rax)
movl $0x0, 0x8(%rax)
movl $0x10, (%rax)
leaq 0x198(%rsp), %rsi
movl $0x4, %ecx
movl $0x40, %r8d
movl $0x10, %r9d
movl %r9d, %edx
callq 0x1cad0
jmp 0x1ba5b
leaq 0x198(%rsp), %rdi
callq 0x3150
leaq 0x197(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x13a38, %rax          # imm = 0x13A38
movq %rax, 0x60(%rsp)
leaq 0x16f(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x33d0
movq 0x68(%rsp), %rdx
leaq 0x848b(%rip), %rsi      # 0x23f31
leaq 0x170(%rsp), %rdi
callq 0x32e0
jmp 0x1bab5
movq 0x60(%rsp), %rdi
movq %rsp, %rax
movl $0x8, 0x10(%rax)
movl $0x0, 0x8(%rax)
movl $0x10, (%rax)
leaq 0x170(%rsp), %rsi
movl $0x4, %ecx
movl $0x40, %r8d
movl $0x10, %r9d
movl %r9d, %edx
callq 0x1cad0
jmp 0x1baf4
leaq 0x170(%rsp), %rdi
callq 0x3150
leaq 0x16f(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x23de0, %rax          # imm = 0x23DE0
movq %rax, 0x50(%rsp)
leaq 0x147(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x33d0
movq 0x58(%rsp), %rdx
leaq 0x83f7(%rip), %rsi      # 0x23f36
leaq 0x148(%rsp), %rdi
callq 0x32e0
jmp 0x1bb4e
movq 0x50(%rsp), %rdi
movq %rsp, %rax
movl $0x10, 0x10(%rax)
movl $0x0, 0x8(%rax)
movl $0x20, (%rax)
leaq 0x148(%rsp), %rsi
movl $0x80, %edx
movl $0xc, %ecx
movl $0x600, %r8d            # imm = 0x600
movl $0x20, %r9d
callq 0x1cad0
jmp 0x1bb8f
leaq 0x148(%rsp), %rdi
callq 0x3150
leaq 0x147(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x34188, %rax          # imm = 0x34188
movq %rax, 0x40(%rsp)
leaq 0x11f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x33d0
movq 0x48(%rsp), %rdx
leaq 0x8361(%rip), %rsi      # 0x23f3b
leaq 0x120(%rsp), %rdi
callq 0x32e0
jmp 0x1bbe9
movq 0x40(%rsp), %rdi
movq %rsp, %rax
movl $0x8, 0x10(%rax)
movl $0x40, 0x8(%rax)
movl $0x40, (%rax)
leaq 0x120(%rsp), %rsi
movl $0x8, %ecx
movl $0x200, %r8d            # imm = 0x200
movl $0x40, %r9d
movl %r9d, %edx
callq 0x1cad0
jmp 0x1bc28
leaq 0x120(%rsp), %rdi
callq 0x3150
leaq 0x11f(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x44530, %rax          # imm = 0x44530
movq %rax, 0x30(%rsp)
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x33d0
movq 0x38(%rsp), %rdx
leaq 0x82cc(%rip), %rsi      # 0x23f3f
leaq 0xf8(%rsp), %rdi
callq 0x32e0
jmp 0x1bc82
movq 0x30(%rsp), %rdi
movq %rsp, %rax
movl $0x8, 0x10(%rax)
movl $0x40, 0x8(%rax)
movl $0x40, (%rax)
leaq 0xf8(%rsp), %rsi
movl $0x8, %ecx
movl $0x200, %r8d            # imm = 0x200
movl $0x40, %r9d
movl %r9d, %edx
callq 0x1cad0
jmp 0x1bcc1
leaq 0xf8(%rsp), %rdi
callq 0x3150
leaq 0xf7(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
addq $0x548d8, %rax          # imm = 0x548D8
movq %rax, 0x20(%rsp)
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x33d0
movq 0x28(%rsp), %rdx
leaq 0x8237(%rip), %rsi      # 0x23f43
leaq 0xd0(%rsp), %rdi
callq 0x32e0
jmp 0x1bd1b
movq 0x20(%rsp), %rdi
movq %rsp, %rax
movl $0x10, 0x10(%rax)
movl $0x20, 0x8(%rax)
movl $0x20, (%rax)
leaq 0xd0(%rsp), %rsi
movl $0x200, %edx            # imm = 0x200
movl $0x8, %ecx
movl $0x1000, %r8d           # imm = 0x1000
movl $0x20, %r9d
callq 0x1cad0
jmp 0x1bd5c
leaq 0xd0(%rsp), %rdi
callq 0x3150
leaq 0xcf(%rsp), %rdi
callq 0x3260
movq 0xa0(%rsp), %rax
movl $0x0, (%rax)
movq $0x0, 0x8(%rax)
movq $0x0, 0x8b0(%rax)
movq $0x0, 0x8b8(%rax)
movq $0x0, 0x8c0(%rax)
movq $0x0, 0x8c8(%rax)
movq $0x0, 0x8d0(%rax)
movq $0x0, 0x8d8(%rax)
movq $0x0, 0x8e0(%rax)
movq $0x0, 0x8e8(%rax)
movq $0x0, 0x8f0(%rax)
movq $0x0, 0x8f8(%rax)
movq $0x0, 0x900(%rax)
movq $0x0, 0x908(%rax)
movq $0x989680, 0x910(%rax) # imm = 0x989680
movq $0x0, 0x918(%rax)
movl $0x0, 0x920(%rax)
movl $0x0, 0x924(%rax)
movl $0x0, 0x928(%rax)
movl $0x0, 0x92c(%rax)
movl $0x0, 0x3670(%rax)
movl $0x0, 0x3674(%rax)
movb $0x0, 0x3678(%rax)
movq $0x0, 0x3680(%rax)
movq $0x0, 0x3688(%rax)
movl $0x0, 0xc8(%rsp)
cmpl $0x400, 0xc8(%rsp) # imm = 0x400
jae 0x1c164
movq 0xa0(%rsp), %rax
movl 0xc8(%rsp), %ecx
movq $-0x1, 0xa30(%rax,%rcx,8)
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x1be8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1bf00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x3150
leaq 0x21f(%rsp), %rdi
callq 0x3260
jmp 0x1c368
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1bf49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x1e8(%rsp), %rdi
callq 0x3150
leaq 0x1e7(%rsp), %rdi
callq 0x3260
jmp 0x1c35b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1bf92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x3150
leaq 0x1bf(%rsp), %rdi
callq 0x3260
jmp 0x1c34e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1bfdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x3150
leaq 0x197(%rsp), %rdi
callq 0x3260
jmp 0x1c341
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1c024
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x3150
leaq 0x16f(%rsp), %rdi
callq 0x3260
jmp 0x1c337
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1c06d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x3150
leaq 0x147(%rsp), %rdi
callq 0x3260
jmp 0x1c32d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1c0b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x3150
leaq 0x11f(%rsp), %rdi
callq 0x3260
jmp 0x1c323
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1c0ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x3150
leaq 0xf7(%rsp), %rdi
callq 0x3260
jmp 0x1c319
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x1c148
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x3150
leaq 0xcf(%rsp), %rdi
callq 0x3260
movq 0x30(%rsp), %rdi
callq 0x1d250
jmp 0x1c319
movq 0xa0(%rsp), %rax
movq $0x0, 0x2a30(%rax)
movq $0x0, 0x2a38(%rax)
movl $0x0, 0xc4(%rsp)
cmpl $0x100, 0xc4(%rsp) # imm = 0x100
jae 0x1c1d9
movq 0xa0(%rsp), %rax
movl 0xc4(%rsp), %ecx
movl $0x100, 0x2a40(%rax,%rcx,4) # imm = 0x100
movl 0xc4(%rsp), %ecx
movl $0x100, 0x2e48(%rax,%rcx,4) # imm = 0x100
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x1c18d
movq 0xa0(%rsp), %rax
movl $0x0, 0x2e40(%rax)
movl $0x0, 0x3248(%rax)
movl $0x0, 0x2e44(%rax)
movl $0x0, 0x324c(%rax)
movl $0x0, 0xc0(%rsp)
cmpl $0x48, 0xc0(%rsp)
jae 0x1c25d
movq 0xa0(%rsp), %rax
movl 0xc0(%rsp), %ecx
movl $0x48, 0x3250(%rax,%rcx,4)
movl 0xc0(%rsp), %ecx
movl $0x48, 0x3378(%rax,%rcx,4)
movl 0xc0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc0(%rsp)
jmp 0x1c214
movq 0xa0(%rsp), %rax
movl $0x0, 0x3370(%rax)
movl $0x0, 0x3498(%rax)
movl $0x0, 0x3374(%rax)
movl $0x0, 0x349c(%rax)
movl $0x0, 0xbc(%rsp)
cmpl $0x38, 0xbc(%rsp)
jae 0x1c2e1
movq 0xa0(%rsp), %rax
movl 0xbc(%rsp), %ecx
movl $0x38, 0x34a0(%rax,%rcx,4)
movl 0xbc(%rsp), %ecx
movl $0x38, 0x3588(%rax,%rcx,4)
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x1c298
movq 0xa0(%rsp), %rax
movl $0x0, 0x3580(%rax)
movl $0x0, 0x3668(%rax)
movl $0x0, 0x3584(%rax)
movl $0x0, 0x366c(%rax)
addq $0x248, %rsp            # imm = 0x248
retq
movq 0x40(%rsp), %rdi
callq 0x1d250
movq 0x50(%rsp), %rdi
callq 0x1d250
movq 0x60(%rsp), %rdi
callq 0x1d250
movq 0x70(%rsp), %rdi
callq 0x1d250
movq 0x80(%rsp), %rdi
callq 0x1d360
movq 0x90(%rsp), %rdi
callq 0x1d360
movq 0xa8(%rsp), %rdi
callq 0x1d3a0
movq 0x210(%rsp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)
nop