// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: setup_counter_groups
void setup_counter_groups(struct counter_group **counter_group_list){

  int i,count;
  struct counter_group *cgroup;

  // note: These get pushed onto a linked list, so last listed is first printed
  if (counter_mask & (COUNTER_DCACHE|COUNTER_ICACHE|COUNTER_TLB)){
    if (cgroup = cache_counter_group("cache",counter_mask)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;
    }
  }

  if (counter_mask & COUNTER_FLOAT){
    if (cgroup = raw_counter_group("float",COUNTER_FLOAT)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }

  if (counter_mask & COUNTER_OPCACHE){
    if (cgroup = raw_counter_group("op cache",COUNTER_OPCACHE)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }    
  }
  

  if (counter_mask & COUNTER_MEMORY){
    if (cgroup = raw_counter_group("memory",COUNTER_MEMORY)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }

  if (counter_mask & COUNTER_L3CACHE){
    if (cgroup = raw_counter_group("l3 cache",COUNTER_L3CACHE)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }    
  }  

  if (counter_mask & COUNTER_L2CACHE){
    if (cgroup = raw_counter_group("l2 cache",COUNTER_L2CACHE)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }    
  }

  if (counter_mask & COUNTER_BRANCH){
    if (cgroup = raw_counter_group("branch",COUNTER_BRANCH)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }        
  }

  if (counter_mask & COUNTER_TOPDOWN_OP){
    if (cgroup = raw_counter_group("topdown-op",COUNTER_TOPDOWN_OP)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }    
      
  if (counter_mask & COUNTER_TOPDOWN_FE){
    if (cgroup = raw_counter_group("topdown-fe",COUNTER_TOPDOWN_FE)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }  

  if (counter_mask & COUNTER_TOPDOWN_BE){
    if (cgroup = raw_counter_group("topdown-be",COUNTER_TOPDOWN_BE)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }  
  
  if (counter_mask & COUNTER_TOPDOWN2){
    if (cgroup = raw_counter_group("topdown2",COUNTER_TOPDOWN2)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }  
  
  if (counter_mask & COUNTER_TOPDOWN){
    if (cgroup = raw_counter_group("topdown",COUNTER_TOPDOWN)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;      
    }
  }  

  if (counter_mask & COUNTER_IPC){
    if (cgroup = raw_counter_group("ipc",COUNTER_IPC)){
      cgroup->next = *counter_group_list;
      *counter_group_list = cgroup;		
    }
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xc7d1(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x2180, %eax           # imm = 0x2180
cmpl $0x0, %eax
je 0x5a4a
leaq 0xc7be(%rip), %rax      # 0x121d4
movl (%rax), %esi
leaq 0x9001(%rip), %rdi      # 0xea20
callq 0x55a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5a48
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5a4a
leaq 0xc783(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x5a94
leaq 0x77b1(%rip), %rdi      # 0xd215
movl $0x10000, %esi          # imm = 0x10000
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5a92
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5a94
leaq 0xc739(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x5ade
leaq 0x8f5d(%rip), %rdi      # 0xea0b
movl $0x4000, %esi           # imm = 0x4000
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5adc
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5ade
leaq 0xc6ef(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x5b28
leaq 0x7740(%rip), %rdi      # 0xd238
movl $0x1000, %esi           # imm = 0x1000
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5b26
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5b28
leaq 0xc6a5(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x5b72
leaq 0x8ed2(%rip), %rdi      # 0xea14
movl $0x800, %esi            # imm = 0x800
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5b70
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5b72
leaq 0xc65b(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x5bbc
leaq 0x8e91(%rip), %rdi      # 0xea1d
movl $0x400, %esi            # imm = 0x400
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5bba
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5bbc
leaq 0xc611(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x5c04
leaq 0x760f(%rip), %rdi      # 0xd1e3
movl $0x40, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5c02
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5c04
leaq 0xc5c9(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x5c4c
leaq 0x8e0a(%rip), %rdi      # 0xea26
movl $0x20, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5c4a
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5c4c
leaq 0xc581(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x5c94
leaq 0x8dcd(%rip), %rdi      # 0xea31
movl $0x8, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5c92
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5c94
leaq 0xc539(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x5cdc
leaq 0x8d90(%rip), %rdi      # 0xea3c
movl $0x10, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5cda
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5cdc
leaq 0xc4f1(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x5d24
leaq 0x7594(%rip), %rdi      # 0xd288
movl $0x4, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5d22
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5d24
leaq 0xc4a9(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5d6c
leaq 0x7541(%rip), %rdi      # 0xd27d
movl $0x2, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5d6a
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5d6c
leaq 0xc461(%rip), %rax      # 0x121d4
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5db4
leaq 0x74ad(%rip), %rdi      # 0xd231
movl $0x1, %esi
callq 0x57a0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5db2
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5db4
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)