LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Map.cpp
// Function: Map::addLine(bool)
void Map::addLine(bool onTop)
{
   // aumento la altezza della mappa
   height++;

   // Crea una nuova riga
   listaY* newLine = new listaY;
   newLine->down = NULL;
   newLine->h = new listaX;
   newLine->h->next = NULL;
   newLine->h->val = 0;
   newLine->h->pres = 0;

   // Popolo la riga appena creata
   // i conta da 1 perchè un nodo lo ho gia' creato sopra
   for (int i = 1; i < width; i++)
   {
      // salva il vecchio nodo
      listaX* tmpx = newLine->h;

      // crea il nuovo nodo in testa
      newLine->h = new listaX;
      newLine->h->val = 0;
      newLine->h->pres = 0;
      newLine->h->next = tmpx;
   }

   // mette la riga creata in testa o in coda
   if (onTop)
   {
      // Aggiorna il valore mostUp
      mostUp++;

      // Se in testa
      listaY* tmpy = origin;

      origin = newLine;
      origin->down = tmpy;
   }
   else
   {
      // Se in coda
      listaY* iter = origin;

      while(iter->down != NULL) // scorro fino alla ultima riga
         iter = iter->down;

      iter->down = newLine;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, -0x2c(%rbp)
movq %rdi, %r14
incl 0xc(%rdi)
pushq $0x10
popq %rdi
callq 0x2130
movq %rax, %rbx
andq $0x0, (%rax)
pushq $0x18
popq %r12
movq %r12, %rdi
callq 0x2130
movq %rax, %r13
movb $0x0, 0x10(%rax)
movq %rax, 0x8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r14, -0x38(%rbp)
movl 0x8(%r14), %r15d
pushq $0x1
popq %r14
cmpl %r15d, %r14d
jge 0x37a9
movq %r12, %rdi
callq 0x2130
movb $0x0, 0x10(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x8(%rbx)
movq %r13, (%rax)
incl %r14d
movq %rax, %r13
jmp 0x3784
cmpb $0x0, -0x2c(%rbp)
je 0x37c1
movq -0x38(%rbp), %rcx
incl 0x14(%rcx)
movq (%rcx), %rax
movq %rbx, (%rcx)
movq %rax, (%rbx)
jmp 0x37d6
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x37c8
movq %rbx, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Hud.cpp
// Function: c_in_str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char)
bool c_in_str(std::string s, char c)
{
   for (int i=0; i < s.size(); i++)
      if (s[i] == c)
         return true;

   return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
xorl %edx, %edx
movq %rdx, %rcx
cmpq %rdx, %rax
je 0x38ff
movq (%rdi), %r8
leaq 0x1(%rcx), %rdx
cmpb %sil, (%r8,%rcx)
jne 0x38ea
cmpq %rcx, %rax
seta %al
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Hud.cpp
// Function: printTitle()
void printTitle()
{
   std::cout<<std::endl;
   std::cout<<"          ██ ▄█▀ ███▄    █  ▒█████    ██████   ██████  ▒█████    ██████ "<<std::endl;
   std::cout<<"          ██▄█▒  ██ ▀█   █ ▒██▒  ██▒▒██    ▒ ▒██    ▒ ▒██▒  ██▒▒██    ▒ "<<std::endl;
   std::cout<<"          ▓███▄░ ▓██  ▀█ ██▒▒██░  ██▒░ ▓██▄   ░ ▓██▄   ▒██░  ██▒░ ▓██▄   "<<std::endl;
   std::cout<<"          ▓██ █▄ ▓██▒  ▐▌██▒▒██   ██░  ▒   ██▒  ▒   ██▒▒██   ██░  ▒   ██▒"<<std::endl;
   std::cout<<"          ▒██▒ █▄▒██░   ▓██░░ ████▓▒░▒██████▒▒▒██████▒▒░ ████▓▒░▒██████▒▒"<<std::endl;
   std::cout<<"          ▒ ▒▒ ▓▒░ ▒░   ▒ ▒ ░ ▒░▒░▒░ ▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░░ ▒░▒░▒░ ▒ ▒▓▒ ▒ ░"<<std::endl;
   std::cout<<"          ░ ░▒ ▒░░ ░░   ░ ▒░  ░ ▒ ▒░ ░ ░▒  ░ ░░ ░▒  ░ ░  ░ ▒ ▒░ ░ ░▒  ░ ░"<<std::endl;
   std::cout<<"          ░ ░░ ░    ░   ░ ░ ░ ░ ░ ▒  ░  ░  ░  ░  ░  ░  ░ ░ ░ ▒  ░  ░  ░  "<<std::endl;
   std::cout<<"          ░  ░            ░     ░ ░        ░        ░      ░ ░       "<<std::endl; 
   std::cout<<"          ░                                                        "<<std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0xa2a0(%rip), %rbx      # 0xffd0
movq %rbx, %rdi
callq 0x2090
leaq 0x57d4(%rip), %rsi      # 0xb513
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5856(%rip), %rsi      # 0xb5ac
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x58d0(%rip), %rsi      # 0xb63d
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5959(%rip), %rsi      # 0xb6dd
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x59d8(%rip), %rsi      # 0xb773
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5a7d(%rip), %rsi      # 0xb82f
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5b04(%rip), %rsi      # 0xb8cd
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5b7b(%rip), %rsi      # 0xb95b
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5bde(%rip), %rsi      # 0xb9d5
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq 0x5c1f(%rip), %rsi      # 0xba2d
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2090
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/ClassPlayer.cpp
// Function: Player::Player(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int)
Player::Player(std::string n, int life, int att, int np)
{
   name = n;
   hp = life;
   atk = att;
   numPlay = np;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r15d
movl %edx, %r13d
movq %rdi, %r12
leaq 0x8(%rdi), %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
xorl %eax, %eax
movb %al, 0x18(%rdi)
leaq 0x30(%rdi), %rcx
movq %rcx, -0x30(%rbp)
leaq 0x40(%rdi), %rcx
movq %rcx, 0x30(%rdi)
andq $0x0, 0x38(%rdi)
movb %al, 0x40(%rdi)
movq %rbx, %rdi
callq 0x20a0
movl %r13d, (%r12)
movl %r15d, 0x4(%r12)
movl %r14d, 0x28(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2080
movq %r14, %rdi
callq 0x2220
nop
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/ClassPlayer.cpp
// Function: Player::diceRoll_or()
int Player::diceRoll_or() 
{
   srand(time(0));
   int roll = (rand()%20) +1;
   switch(roll)
   {
      case 1: case 2: case 3: case 4: case 5:
      // non succede niente
      return roll;

      // trovato scudo oro
      case 6:
         shield = "gold";
      return roll;

      // se scudo oro trovata pozione curativa
      // scudo argento altrimenti
      case 7: 
            hp += 8;
            return 71;
         
     case 8:   
            hp -=8;
            return 72;
   
      // se senza scudo trovo scudo bronzo
      // piccola arma altrimenti
      case 9: case 10: case 11: case 12:
         if (shield == "")
         {
            shield = "bronze";
            return 91;
         }
         else
         {
            atk += 1;
            return 92;
         }
      break;
   
      // trappola, danno incodizionato
      case 13: case 14: case 15: case 16: case 17:
         hp -= 4;
      return roll;
   
      // trovata spada argento
      case 18: case 19:
         atk+=4;
      return roll;

      // trovata spada magica
      case 20:
         hp += 5;
         atk += 5;
      return roll;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2100
movl %eax, %edi
callq 0x2110
callq 0x2050
pushq $0x14
popq %rcx
cltd
idivl %ecx
leal 0x1(%rdx), %eax
leaq 0x5f3f(%rip), %rsi      # 0xc8c0
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
addl $-0x4, (%rbx)
jmp 0x69f5
leaq 0x30(%rbx), %r14
leaq 0x5ebc(%rip), %rsi      # 0xc856
movq %r14, %rdi
callq 0x69fa
testb %al, %al
je 0x69bf
leaq 0x5f63(%rip), %rsi      # 0xc910
movq %r14, %rdi
callq 0x2250
pushq $0x5b
jmp 0x69f4
addl $0x4, 0x4(%rbx)
jmp 0x69f5
incl 0x4(%rbx)
pushq $0x5c
jmp 0x69f4
addl $0x5, (%rbx)
addl $0x5, 0x4(%rbx)
movl %ecx, %eax
jmp 0x69f5
addq $0x30, %rbx
leaq 0x5f42(%rip), %rsi      # 0xc91e
movq %rbx, %rdi
callq 0x2250
pushq $0x6
jmp 0x69f4
addl $0x8, (%rbx)
pushq $0x47
jmp 0x69f4
addl $-0x8, (%rbx)
pushq $0x48
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Menu.cpp
// Function: setPlayers()
int setPlayers()
{
	int  numberP = 0;
	while (numberP < 2)		//itero finche' il numero di giocatori e' <= a 2
	{
                for (int i=0; i<40; i++, std::cout<<"\n");				//spazio fra una schermata e l'altra
		stampaMenu("Quanti giocatori?","","[minimo 2 giocatori]","", 1);	//stampo il menu
		std::cin>> numberP;
               if(!std::cin){
                
                 std::cin.clear();
                 std::cin.ignore();
               }
	
	}
	
	return (numberP);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq -0x30(%rbp), %rax
andl $0x0, (%rax)
xorl %eax, %eax
leaq -0xb0(%rbp), %rbx
leaq 0x5338(%rip), %r13      # 0xc856
movq 0x8aab(%rip), %r15      # 0xffd0
leaq 0x5329(%rip), %r14      # 0xc855
cmpl $0x1, %eax
jg 0x7622
movq %rbx, %r12
pushq $0x28
popq %rbx
subl $0x1, %ebx
jb 0x754d
movq %r15, %rdi
movq %r14, %rsi
callq 0x2120
jmp 0x753b
movq %r12, %rbx
movq %r12, %rdi
leaq 0x5ca0(%rip), %rsi      # 0xd1fa
leaq -0x2c(%rbp), %rdx
callq 0x2b10
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
leaq -0x2b(%rbp), %rdx
callq 0x2b10
leaq -0x70(%rbp), %rdi
leaq 0x5c8e(%rip), %rsi      # 0xd20c
leaq -0x2a(%rbp), %rdx
callq 0x2b10
leaq -0x90(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq -0x29(%rbp), %rdx
callq 0x2b10
leaq -0x50(%rbp), %rax
movq %r12, %r13
movq %rbx, %rdi
movq %rax, %rsi
leaq -0x70(%rbp), %r12
movq %r12, %rdx
movq %r13, %rcx
pushq $0x1
popq %r8
callq 0x6a0c
movq %r13, %rdi
callq 0x2080
movq %r12, %rdi
callq 0x2080
leaq -0x50(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2080
movq 0x89fb(%rip), %r12      # 0xffe0
movq %r12, %rdi
leaq -0x30(%rbp), %rsi
callq 0x20b0
movq (%r12), %rax
movq -0x18(%rax), %rdi
testb $0x5, 0x20(%r12,%rdi)
je 0x7613
addq %r12, %rdi
xorl %esi, %esi
callq 0x2200
movq %r12, %rdi
callq 0x2240
movl -0x30(%rbp), %eax
leaq 0x5239(%rip), %r13      # 0xc856
jmp 0x752c
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2080
jmp 0x7648
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x2080
jmp 0x7656
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2080
jmp 0x7664
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Game.cpp
// Function: battleChoice()
bool battleChoice()
{
	std::string choice;

	std::cout<<"Vuoi combattere? [y/n]\n";
	std::cin>>choice;

	if (choice == "y") 
		return true;
	
	else if (choice == "n")
		return false;
	
	else
		return battleChoice();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
leaq -0x18(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x85a4(%rip), %rdi      # 0xffd0
leaq 0x5854(%rip), %rsi      # 0xd287
callq 0x2120
movq 0x85a1(%rip), %rdi      # 0xffe0
leaq -0x28(%rbp), %rsi
callq 0x2190
leaq 0x5850(%rip), %rsi      # 0xd29f
leaq -0x28(%rbp), %rdi
callq 0x69fa
movb $0x1, %bl
testb %al, %al
jne 0x7a7d
leaq 0x583c(%rip), %rsi      # 0xd2a1
leaq -0x28(%rbp), %rdi
callq 0x69fa
testb %al, %al
je 0x7a76
xorl %ebx, %ebx
jmp 0x7a7d
callq 0x7a0c
movl %eax, %ebx
leaq -0x28(%rbp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/giovifazi[P]knossos-bloodbath/Game.cpp
// Function: get_player_input(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
char get_player_input(std::string allowed)
{
   // Dichiarazione e inserimento della stringa di input
   std::string input;
   std::cin >> input;

   // finche l' input non è un comando valido notifica un errore
   while(!is_command(input, allowed))
   {
      std::cout << "Comando non valido, inserire solo un carattere valido!\n";
      std::cin >> input;
   }
   
   return input[0];  // ritorna il char del comando
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x84d7(%rip), %rdi      # 0xffe0
leaq -0x48(%rbp), %rsi
callq 0x2190
leaq -0x68(%rbp), %r14
leaq -0x48(%rbp), %r15
leaq -0x88(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x21d0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x7aa3
movl %eax, %r13d
movq %r12, %rdi
callq 0x2080
movq %r14, %rdi
callq 0x2080
testb %r13b, %r13b
jne 0x7b7e
movq 0x846f(%rip), %rdi      # 0xffd0
leaq 0x573b(%rip), %rsi      # 0xd2a3
callq 0x2120
movq 0x846c(%rip), %rdi      # 0xffe0
movq %r15, %rsi
callq 0x2190
jmp 0x7b21
leaq -0x48(%rbp), %rdi
movq (%rdi), %rax
movb (%rax), %bl
callq 0x2080
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7bad
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x2080
jmp 0x7bb0
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/./io.h
// Function: rnorm(double, double)
double rnorm(double mu, double sigma)
{
    const double epsilon = std::numeric_limits<double>::min();
    const double two_pi = 2.0*3.14159265358979323846;

    static double z0, z1;
    static bool generate;
    generate = !generate;

    if (!generate)
        return z1 * sigma + mu;

    double u1, u2;
    do
    {
        u1 = rand() * (1.0 / RAND_MAX);
        u2 = rand() * (1.0 / RAND_MAX);
    }
    while ( u1 <= epsilon );

    z0 = sqrt(-2.0 * log(u1)) * cos(two_pi * u2);
    z1 = sqrt(-2.0 * log(u1)) * sin(two_pi * u2);
    return z0 * sigma + mu;
}

// Assembly:
subq $0x28, %rsp
movb 0x2a50a(%rip), %al      # 0x315d0
movl %eax, %ecx
xorb $0x1, %cl
movb %cl, 0x2a4ff(%rip)      # 0x315d0
testb %al, %al
je 0x70e1
leaq 0x2a4ec(%rip), %rax     # 0x315c8
jmp 0x71d3
movsd %xmm0, 0x18(%rsp)
movsd %xmm1, 0x20(%rsp)
callq 0x6150
cvtsi2sd %eax, %xmm0
mulsd 0x17f0a(%rip), %xmm0    # 0x1f008
movsd %xmm0, (%rsp)
callq 0x6150
movsd (%rsp), %xmm0
movsd 0x17efb(%rip), %xmm1    # 0x1f010
ucomisd %xmm0, %xmm1
jae 0x70ed
cvtsi2sd %eax, %xmm1
mulsd 0x17ee1(%rip), %xmm1    # 0x1f008
movsd %xmm1, 0x8(%rsp)
callq 0x63d0
mulsd 0x17ede(%rip), %xmm0    # 0x1f018
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x714a
sqrtsd %xmm0, %xmm0
jmp 0x714f
callq 0x63b0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd 0x17ebd(%rip), %xmm0    # 0x1f020
movsd %xmm0, 0x8(%rsp)
callq 0x6a80
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x2a444(%rip)    # 0x315c0
movsd (%rsp), %xmm0
callq 0x63d0
mulsd 0x17e8a(%rip), %xmm0    # 0x1f018
ucomisd 0x17e92(%rip), %xmm0    # 0x1f028
jb 0x719e
sqrtsd %xmm0, %xmm0
jmp 0x71a3
callq 0x63b0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x60f0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x2a408(%rip)    # 0x315c8
leaq 0x2a3f9(%rip), %rax     # 0x315c0
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
mulsd (%rax), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x28, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/./io.h
// Function: randn(int, double, double)
std::vector<double> randn(int n, double mu = 0.0, double sigma = 1.0)
{
    std::vector<double> x(n);
    for (int i = 0; i < n; ++i)
    {
        x[i] = rnorm(mu, sigma);
    }
    return x;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rdi, %rbx
movslq %esi, %r14
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x7b16
xorl %r15d, %r15d
testl %r14d, %r14d
cmovlel %r15d, %r14d
cmpq %r15, %r14
je 0x723a
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x70bc
movq (%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
jmp 0x7216
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/./io.h
// Function: diag_dom_rand(int, double)
std::vector<double> diag_dom_rand(int n, double difficulty = .5)
{
    double sigma = 100.0;
    double mu = difficulty * sigma;
    std::vector<double> A = randn(n*n, mu, sigma);
    std::vector<double> abssums(n);
    // get max row absolute sum
    double abssum_max = 0.0;
    for (int i = 0; i < n; ++i)
    {
        double abssum = 0.0;
        for (int j = 0; j < n; ++j)
        {
            abssum += std::fabs(A[i*n+j]);
        }
        if (abssum > abssum_max)
            abssum_max = abssum;
    }
    // add abssum max to abs of diagonal
    for (int i = 0; i < n; ++i)
    {
        A[i*n+i] = std::fabs(A[i*n+i]) + abssum_max;
    }
    return A;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movsd 0x17dd4(%rip), %xmm1    # 0x1f030
mulsd %xmm1, %xmm0
imull %esi, %esi
callq 0x71e4
movslq %ebp, %r14
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %r14, %rsi
callq 0x7b16
movq (%rbx), %rax
xorl %edx, %edx
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %ebp, %ecx
movl %r14d, %esi
shlq $0x3, %r14
xorpd %xmm1, %xmm1
movapd 0x17dc0(%rip), %xmm0    # 0x1f060
movq %rax, %rdi
cmpq %rcx, %rdx
je 0x72d7
xorpd %xmm2, %xmm2
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0x72c7
movsd (%rdi,%r8,8), %xmm3
andpd %xmm0, %xmm3
addsd %xmm3, %xmm2
incq %r8
jmp 0x72af
maxsd %xmm1, %xmm2
incq %rdx
addq %r14, %rdi
movapd %xmm2, %xmm1
jmp 0x72a3
incl %ebp
xorl %edx, %edx
subq $0x1, %rcx
jb 0x72fa
movslq %edx, %rdx
movsd (%rax,%rdx,8), %xmm2
andpd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rax,%rdx,8)
addl %ebp, %edx
jmp 0x72db
leaq 0x8(%rsp), %rdi
callq 0x7db6
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x7db6
movq %r14, %rdi
callq 0x69c0
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_tests.cpp
// Function: get_grid_comm(ompi_communicator_t**)
void get_grid_comm(MPI_Comm* grid_comm)
{
    // get comm size and rank
    int rank, p;
    MPI_Comm_size(MPI_COMM_WORLD, &p);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    int q = (int)sqrt(p);
    ASSERT_EQ(q*q, p) << "Number of processors must be a perfect square.";

    // split into grid communicator
    int dims[2] = {q, q};
    int periods[2] = {0, 0};
    MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, 0, grid_comm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x29c61(%rip), %r14     # 0x30f98
leaq 0x1c(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6600
leaq 0x34(%rsp), %rsi
movq %r14, %rdi
callq 0x67d0
cvtsi2sdl (%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x7369
sqrtsd %xmm0, %xmm0
jmp 0x736e
callq 0x63b0
cvttsd2si %xmm0, %ebp
movl %ebp, %eax
imull %ebp, %eax
leaq 0x8(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x17ceb(%rip), %rsi     # 0x1f070
leaq 0x1ac17(%rip), %rdx     # 0x21fa3
leaq 0x20(%rsp), %r14
leaq 0x1c(%rsp), %r8
movq %r14, %rdi
callq 0x7e91
cmpb $0x0, (%r14)
je 0x73de
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x7c34
movl %ebp, -0x8(%r14)
movl %ebp, -0x4(%r14)
leaq 0x8(%rsp), %rcx
andq $0x0, (%rcx)
movq 0x29bcf(%rip), %rdi     # 0x30f98
pushq $0x2
popq %rsi
leaq 0x20(%rsp), %rdx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x6090
jmp 0x745a
leaq 0x8(%rsp), %rdi
callq 0x9c42
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x17c7c(%rip), %rsi     # 0x1f074
callq 0x64a0
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x740c
movq (%rax), %r8
jmp 0x7413
leaq 0x19802(%rip), %r8      # 0x20c15
leaq 0x17c89(%rip), %rdx     # 0x1f0a3
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x27
popq %rcx
callq 0x8612
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8690
leaq 0x28(%rsp), %rbx
leaq 0x10(%rsp), %rdi
callq 0x8672
leaq 0x8(%rsp), %rdi
callq 0x7bee
movq %rbx, %rdi
callq 0x7c34
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8672
jmp 0x7479
jmp 0x7476
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7bee
jmp 0x7488
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7c34
movq %rbx, %rdi
callq 0x69c0
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_tests.cpp
// Function: MpiTest_MatrixVectorMult1_Test::TestBody()
TEST(MpiTest, MatrixVectorMult1)
{
    // simple 4 by 4 input matrix
    double A[4*4] = {10., -1., 2., 0.,
                           -1., 11., -1., 3.,
                           2., -1., 10., -1.,
                           0.0, 3., -1., 8.};
    double x[4] =  {6., 25., -11., 15.};
    double y[4];
    double expected_y[4] = {13.,  325., -138.,  206.};
    int n = 4;

    // get grid communicator
    MPI_Comm grid_comm;
    get_grid_comm(&grid_comm);

    // testing sequential matrix multiplication
    mpi_matrix_vector_mult(n, A, x, y, grid_comm);

    // checking if all values are correct (up to some error value)
    for (int i = 0; i < n; ++i)
    {
        EXPECT_NEAR(expected_y[i], y[i], 1e-10) << " element y[" << i << "] is wrong";
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0x17d5e(%rip), %rsi     # 0x1f210
pushq $0x10
popq %rcx
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
movaps 0x17d19(%rip), %xmm0    # 0x1f1e0
leaq 0x50(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movaps 0x17cf8(%rip), %xmm0    # 0x1f1d0
movaps %xmm0, (%r14)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x7323
movq (%r15), %r8
pushq $0x4
popq %rdi
leaq 0x30(%rsp), %rcx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1e1a7
leaq 0x17caa(%rip), %r12     # 0x1f1b0
xorl %r14d, %r14d
leaq 0x17bc9(%rip), %r13     # 0x1f0d9
leaq 0x10(%rsp), %rbp
leaq 0x8(%rsp), %rbx
leaq 0x20(%rsp), %r15
cmpq $0x4, %r14
je 0x75ff
movsd (%r12), %xmm0
movsd 0x30(%rsp,%r14,8), %xmm1
movq %rbp, %rdi
leaq 0x17b8b(%rip), %rsi     # 0x1f0cb
leaq 0x17b8d(%rip), %rdx     # 0x1f0d4
movq %r13, %rcx
movsd 0x17ae6(%rip), %xmm2    # 0x1f038
callq 0xa22b
cmpb $0x0, 0x10(%rsp)
jne 0x75e9
movq %rbx, %rdi
callq 0x9c42
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x17b65(%rip), %rsi     # 0x1f0df
callq 0x64a0
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x69a0
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x17b4b(%rip), %rsi     # 0x1f0eb
callq 0x64a0
movq 0x18(%rsp), %rax
leaq 0x19664(%rip), %r8      # 0x20c15
testq %rax, %rax
je 0x75b9
movq (%rax), %r8
movq %r15, %rdi
pushq $0x1
popq %rsi
leaq 0x17add(%rip), %rdx     # 0x1f0a3
pushq $0x46
popq %rcx
callq 0x8612
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8690
movq %r15, %rdi
callq 0x8672
movq %rbx, %rdi
callq 0x7bee
leaq 0x18(%rsp), %rdi
callq 0x7c34
incq %r14
addq $0x8, %r12
jmp 0x751f
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7634
jmp 0x7627
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8672
jmp 0x762a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7bee
leaq 0x18(%rsp), %rdi
callq 0x7c34
movq %rbx, %rdi
callq 0x69c0
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_tests.cpp
// Function: MpiTest_Jacobi1_Test::TestBody()
TEST(MpiTest, Jacobi1)
{
    // simple 4 by 4 input matrix
    double A[4*4] = {10., -1., 2., 0.,
                           -1., 11., -1., 3.,
                           2., -1., 10., -1.,
                           0.0, 3., -1., 8.};
    double b[4] =  {6., 25., -11., 15.};
    double x[4];
    double expected_x[4] = {1.0,  2.0, -1.0, 1.0};
    int n = 4;

    // get grid communicator
    MPI_Comm grid_comm;
    get_grid_comm(&grid_comm);

    // testing sequential matrix multiplication
    mpi_jacobi(n, A, b, x, grid_comm);

    // checking if all values are correct (up to some error value)
    for (int i = 0; i < n; ++i)
    {
        EXPECT_NEAR(expected_x[i], x[i], 1e-5) << " element y[" << i << "] is wrong";
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0x17bb2(%rip), %rsi     # 0x1f210
pushq $0x10
popq %rcx
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
movaps 0x17b6d(%rip), %xmm0    # 0x1f1e0
leaq 0x50(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movaps 0x17b4c(%rip), %xmm0    # 0x1f1d0
movaps %xmm0, (%r14)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x7323
movq (%r15), %r8
pushq $0x4
popq %rdi
leaq 0x30(%rsp), %rcx
pushq $0x64
popq %r9
movsd 0x1798c(%rip), %xmm0    # 0x1f038
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1e243
leaq 0x17b32(%rip), %r12     # 0x1f1f0
xorl %r14d, %r14d
leaq 0x17a44(%rip), %r13     # 0x1f10c
leaq 0x10(%rsp), %rbp
leaq 0x8(%rsp), %rbx
leaq 0x20(%rsp), %r15
cmpq $0x4, %r14
je 0x77b7
movsd (%r12), %xmm0
movsd 0x30(%rsp,%r14,8), %xmm1
movq %rbp, %rdi
leaq 0x17a06(%rip), %rsi     # 0x1f0fe
leaq 0x17a08(%rip), %rdx     # 0x1f107
movq %r13, %rcx
movsd 0x17936(%rip), %xmm2    # 0x1f040
callq 0xa22b
cmpb $0x0, 0x10(%rsp)
jne 0x77a1
movq %rbx, %rdi
callq 0x9c42
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x179ad(%rip), %rsi     # 0x1f0df
callq 0x64a0
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x69a0
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x17993(%rip), %rsi     # 0x1f0eb
callq 0x64a0
movq 0x18(%rsp), %rax
leaq 0x194ac(%rip), %r8      # 0x20c15
testq %rax, %rax
je 0x7771
movq (%rax), %r8
movq %r15, %rdi
pushq $0x1
popq %rsi
leaq 0x17925(%rip), %rdx     # 0x1f0a3
pushq $0x62
popq %rcx
callq 0x8612
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8690
movq %r15, %rdi
callq 0x8672
movq %rbx, %rdi
callq 0x7bee
leaq 0x18(%rsp), %rdi
callq 0x7c34
incq %r14
addq $0x8, %r12
jmp 0x76d7
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x77ec
jmp 0x77df
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8672
jmp 0x77e2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7bee
leaq 0x18(%rsp), %rdi
callq 0x7c34
movq %rbx, %rdi
callq 0x69c0
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/./gtest/gtest.h
// Function: testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)
AssertionResult CmpHelperEQ(const char* expected_expression,
                            const char* actual_expression,
                            const T1& expected,
                            const T2& actual) {
#ifdef _MSC_VER
# pragma warning(push)          // Saves the current warning state.
# pragma warning(disable:4389)  // Temporarily disables warning on
                                // signed/unsigned mismatch.
#endif

  if (expected == actual) {
    return AssertionSuccess();
  }

#ifdef _MSC_VER
# pragma warning(pop)          // Restores the warning state.
#endif

  return EqFailure(expected_expression,
                   actual_expression,
                   FormatForComparisonFailureMessage(expected, actual),
                   FormatForComparisonFailureMessage(actual, expected),
                   false);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl (%rcx), %eax
cmpl (%r8), %eax
jne 0x7eb0
movq %rbx, %rdi
callq 0x987f
jmp 0x7f02
movq %r8, %r12
movq %rdx, %r14
movq %rsi, %r15
leaq 0x28(%rsp), %rdi
movq %rcx, %rsi
callq 0x7f35
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x7f35
leaq 0x28(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %r9d, %r9d
callq 0x9fab
leaq 0x8(%rsp), %rdi
callq 0x6b18
leaq 0x28(%rsp), %rdi
callq 0x6b18
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6b18
jmp 0x7f23
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6b18
movq %rbx, %rdi
callq 0x69c0
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_jacobi.cpp
// Function: transpose_bcast_vector(int, double*, double*, ompi_communicator_t*)
void transpose_bcast_vector(const int n, double* col_vector, double* row_vector, MPI_Comm comm)
{
    // obtain the necessary parameters required in thie method
    int rank;
    MPI_Comm_rank(comm, &rank);
    int p;
    MPI_Comm_size(comm, &p);
    int q = sqrt(p);
    int dims[2];
    int coords[2];
    int periods[2];
    MPI_Cart_get(comm, 2, dims, periods, coords);
    MPI_Status stat;

    //first column send to diagonal processors
    int send_rec_count = block_decompose(n, q, coords[0]);
    if (coords[1] == 0) {
        MPI_Send(col_vector, send_rec_count, MPI_DOUBLE, (coords[0] * (q + 1)), 0, comm);
    }
    if (coords[0] == coords[1]) {
        MPI_Recv(row_vector, send_rec_count, MPI_DOUBLE, coords[0] * q, 0, comm, &stat);
    }

    //broadcast columnwise
    MPI_Comm n_comm;
    MPI_Comm_split(comm, coords[1], rank, &n_comm);
    MPI_Bcast(row_vector, block_decompose(n, q, coords[1]), MPI_DOUBLE, coords[1], n_comm);

    // free the useless memory
    MPI_Comm_free(&n_comm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, 0x18(%rsp)
movl %edi, %ebp
leaq 0x14(%rsp), %rsi
movq %rcx, %rdi
callq 0x67d0
leaq 0x24(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6600
cvtsi2sdl (%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1db2a
sqrtsd %xmm0, %xmm0
jmp 0x1db2f
callq 0x63b0
cvttsd2si %xmm0, %r12d
pushq $0x2
popq %rsi
leaq 0x38(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %r8
callq 0x6430
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl %ebp, %eax
cltd
idivl %r12d
movl %eax, %ebp
movl %edx, %r15d
xorl %r13d, %r13d
cmpl %ecx, %edx
setg %r13b
addl %eax, %r13d
testl %r8d, %r8d
jne 0x1db9f
leal 0x1(%r12), %eax
imull %eax, %ecx
movq 0x13425(%rip), %rdx     # 0x30fa8
movq 0x18(%rsp), %rdi
movl %r13d, %esi
xorl %r8d, %r8d
movq %r14, %r9
callq 0x61b0
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %r8d
cmpl %r8d, %ecx
jne 0x1dbd1
imull %r12d, %r8d
leaq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq 0x133f0(%rip), %rdx     # 0x30fa8
movq %rbx, %rdi
movl %r13d, %esi
movl %r8d, %ecx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x63e0
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %edx
leaq 0x28(%rsp), %r12
movq %r14, %rdi
movl %r8d, %esi
movq %r12, %rcx
callq 0x6920
movl 0x10(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %r15d
setg %al
addl %eax, %ebp
movq (%r12), %r8
movq 0x133a7(%rip), %rdx     # 0x30fa8
movq %rbx, %rdi
movl %ebp, %esi
callq 0x60d0
movq %r12, %rdi
callq 0x6900
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_jacobi.cpp
// Function: mpi_matrix_vector_mult(int, double*, double*, double*, ompi_communicator_t*)
void mpi_matrix_vector_mult(const int n, double* A,
                            double* x, double* y, MPI_Comm comm)
{
    // distribute the array onto local processors!
    double* local_A = NULL;
    double* local_x = NULL;
    distribute_matrix(n, &A[0], &local_A, comm);
    distribute_vector(n, &x[0], &local_x, comm);

    // allocate local result space
    double* local_y = new double[block_decompose_by_dim(n, comm, 0)];
    distributed_matrix_vector_mult(n, local_A, local_x, local_y, comm);

    // gather results back to rank 0
    gather_vector(n, local_y, y, comm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r13
movl %edi, %ebp
leaq 0x10(%rsp), %r15
andq $0x0, (%r15)
leaq 0x8(%rsp), %r12
andq $0x0, (%r12)
movq %r15, %rdx
movq %r8, %rcx
callq 0x1d778
movl %ebp, %edi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1d3f4
movl %ebp, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1e2fc
movl %eax, %ecx
shlq $0x3, %rcx
testl %eax, %eax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x6040
movq %rax, %r13
movq (%r15), %rsi
movq (%r12), %rdx
movl %ebp, %edi
movq %rax, %rcx
movq %rbx, %r8
callq 0x1dc22
movl %ebp, %edi
movq %r13, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d5c2
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/mpi_jacobi.cpp
// Function: mpi_jacobi(int, double*, double*, double*, ompi_communicator_t*, int, double)
void mpi_jacobi(const int n, double* A, double* b, double* x, MPI_Comm comm,
                int max_iter, double l2_termination)
{
    // distribute the array onto local processors!
    double* local_A = NULL;
    double* local_b = NULL;
    distribute_matrix(n, &A[0], &local_A, comm);
    distribute_vector(n, &b[0], &local_b, comm);

    // allocate local result space
    double* local_x = new double[block_decompose_by_dim(n, comm, 0)];
    distributed_jacobi(n, local_A, local_b, local_x, comm, max_iter, l2_termination);

    // gather results back to rank 0
    gather_vector(n, local_x, x, comm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movsd %xmm0, 0x8(%rsp)
movl %r9d, %ebp
movq %r8, %rbx
movq %rcx, 0x10(%rsp)
movq %rdx, %r14
movl %edi, %r15d
leaq 0x20(%rsp), %r12
andq $0x0, (%r12)
leaq 0x18(%rsp), %r13
andq $0x0, (%r13)
movq %r12, %rdx
movq %r8, %rcx
callq 0x1d778
movl %r15d, %edi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1d3f4
movl %r15d, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1e2fc
movl %eax, %ecx
shlq $0x3, %rcx
testl %eax, %eax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x6040
movq %rax, %r14
movq (%r12), %rsi
movq (%r13), %rdx
movl %r15d, %edi
movq %rax, %rcx
movq %rbx, %r8
movl %ebp, %r9d
movsd 0x8(%rsp), %xmm0
callq 0x1dddd
movl %r15d, %edi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d5c2
// File: /workspace/github_cpp_makefile_star2_O2/WeihuaZhu[P]hpc_prog2/./utils.h
// Function: block_decompose_by_dim(int, ompi_communicator_t*, int)
inline int block_decompose_by_dim(const int n, MPI_Comm comm, int dim)
{
    // get dimensions
    int dims[2];
    int periods[2];
    int coords[2];
    MPI_Cart_get(comm, 2, dims, periods, coords);
    return block_decompose(n, dims[dim], coords[dim]);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %rax
movl %edi, %ebp
pushq $0x2
popq %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rsp, %r8
movq %rax, %rdi
callq 0x6430
movslq %ebx, %rcx
movl %ebp, %eax
cltd
idivl 0x8(%rsp,%rcx,4)
xorl %esi, %esi
cmpl (%rsp,%rcx,4), %edx
setg %sil
addl %esi, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: elimDups(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void elimDups(vector<string>& words)
{
    // sort words alphabetically so we can find the duplicates
    sort(words.begin(), words.end());

	// print the sorted contents
	for_each(words.begin(), words.end(), PrintString(cerr));
	cerr << endl;

    // unique reorders the input so that each word appears once in the
    // front part of the range
	// returns an iterator one past the unique range;
    auto end_unique = unique(words.begin(), words.end());

    // erase uses a vector operation to remove the nonunique elements
    words.erase(end_unique, words.end());

	// print the reduced vector
	for_each(words.begin(), words.end(), PrintString(cerr));
	cerr << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x8(%rbx), %rsi
callq 0x26df
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x5c82(%rip), %r14      # 0x7ff0
movq %r14, %rdx
callq 0x25be
movq %r14, %rdi
callq 0x20a0
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x2ed2
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x25fa
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
movq %r14, %rdx
callq 0x25be
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20a0
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: biggies(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, unsigned long)
void biggies(vector<string>& words, vector<string>::size_type sz)
{
	elimDups(words);  // puts words in alphabetic order and removes duplicates

    // sort words by size using object of type ShorterString
	// maintaining alphabetic order for words of the same size
    stable_sort(words.begin(), words.end(), ShorterString());

	// use object of type SizeComp to find
	// the first element whose size() is >= sz
    auto wc = find_if(words.begin(), words.end(), SizeComp(sz));

	// compute the number of elements with size >= sz
	auto count = words.end() - wc;

	// print results
    cout << count << " " << make_plural(count, "word", "s")
         << " " << sz << " characters or longer" << endl;

	// use object of type PrintString
	// to print the contents of words, each one followed by a space
	for_each(wc, words.end(), PrintString(cout));
	cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x234a
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3081
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
movq %r15, %rdx
callq 0x3e39
movq %rax, %r14
movq 0x8(%rbx), %r12
subq %rax, %r12
sarq $0x5, %r12
movq 0x5bc8(%rip), %rdi      # 0x7fc8
movq %r12, %rsi
callq 0x2110
leaq 0x2bf5(%rip), %rsi      # 0x5004
movq %rax, %rdi
callq 0x2120
movq %rax, %r13
leaq 0x2be5(%rip), %rsi      # 0x5006
leaq -0x70(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x2060
leaq 0x2bd6(%rip), %rsi      # 0x500b
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x2060
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rdx
leaq -0x50(%rbp), %rcx
movq %r12, %rsi
callq 0x2604
leaq -0x90(%rbp), %rsi
movq %r13, %rdi
callq 0x2100
leaq 0x2b95(%rip), %rsi      # 0x5004
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq %r15, %rsi
callq 0x20c0
leaq 0x2b84(%rip), %rsi      # 0x500d
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x20a0
leaq -0x90(%rbp), %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x70(%rbp), %rdi
callq 0x2090
movq 0x8(%rbx), %rsi
movq 0x5b06(%rip), %rbx      # 0x7fc8
movq %r14, %rdi
movq %rbx, %rdx
callq 0x25be
movq %rbx, %rdi
callq 0x20a0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x24fd
movq %rax, %rbx
jmp 0x2506
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x70(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: main
int main()
{
    vector<string> words;

    // copy contents of each book into a single vector
    string next_word;
    while (cin >> next_word) {
        // insert next book's contents at end of words
        words.push_back(next_word);
    }

	biggies(words, 6);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rbx
andq $0x0, 0x10(%rbx)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%rbx)
movb $0x0, (%rax)
movq 0x5a8e(%rip), %r14      # 0x7fd8
leaq -0x50(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2160
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2574
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2632
jmp 0x254e
leaq -0x30(%rbp), %rdi
pushq $0x6
popq %rsi
callq 0x23b4
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x266e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25a1
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x266e
movq %rbx, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day08/ex01/main.cpp
// Function: main
int main()
{
	int n = 10000;
	Span sp = Span(n);

	std::srand(time(0));
	// for (int i = 0; i < n; i++)
	// 	addNumber(sp, n * 10);
	std::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	sp.addRange(v.begin(), v.end());
	std::cout << "Shortest span: " << sp.shortestSpan() << std::endl;
	std::cout << "Longest span: " << sp.longestSpan() << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
leaq -0x50(%rbp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x1674
xorl %edi, %edi
callq 0x10c0
movl %eax, %edi
callq 0x10d0
leaq -0x30(%rbp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
leaq -0xc(%rbp), %rsi
movl $0x1, (%rsi)
callq 0x14c4
leaq -0xc(%rbp), %rsi
movl $0x2, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x14c4
leaq -0xc(%rbp), %rsi
movl $0x3, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x14c4
leaq -0xc(%rbp), %rsi
movl $0x4, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x14c4
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x18b4
movq 0x2beb(%rip), %rdi      # 0x3fc8
leaq 0xc20(%rip), %rsi       # 0x2004
callq 0x10e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1798
movq %rbx, %rdi
movl %eax, %esi
callq 0x1150
movq %rax, %rdi
callq 0x1070
movq 0x2bba(%rip), %rdi      # 0x3fc8
leaq 0xbff(%rip), %rsi       # 0x2014
callq 0x10e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1828
movq %rbx, %rdi
movl %eax, %esi
callq 0x1150
movq %rax, %rdi
callq 0x1070
leaq -0x30(%rbp), %rdi
callq 0x1486
leaq -0x50(%rbp), %rdi
callq 0x16fc
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
jmp 0x145b
jmp 0x145b
jmp 0x145b
jmp 0x145b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x1486
leaq -0x50(%rbp), %rdi
callq 0x16fc
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::addNumber(int)
void Span::addNumber(int n)
{
	if (this->isInList(n))
		throw std::exception();
	if (this->list.size() >= this->maxItems)
		throw std::exception();
	this->list.push_back(n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, -0xc(%rbp)
callq 0x176e
testb %al, %al
jne 0x1741
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x2, %rax
movl 0x18(%rbx), %ecx
cmpq %rcx, %rax
jae 0x1741
leaq -0xc(%rbp), %rsi
movq %rbx, %rdi
callq 0x197e
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x1080
movq 0x2870(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x287a(%rip), %rsi      # 0x3fd8
movq 0x288b(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1140
nop
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::shortestSpan()
int Span::shortestSpan(void)
{
	int							min;
	int							tmp;
	std::vector<int>::iterator	it1;
	std::vector<int>::iterator	it2;

	if (this->list.size() <= 1)
		throw std::exception();
	min = INT_MAX;
	it1 = this->list.begin();
	while (it1 != this->list.end())
	{
		it2 = this->list.begin();
		while (it2 != this->list.end())
		{
			if (it1 != it2)
			{
				tmp = abs(*it1 - *it2);
				if (tmp < min)
					min = tmp;
			}
			it2++;
		}
		it1++;
	}
	return (min);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, %rax
subq %rcx, %rax
cmpq $0x5, %rax
jb 0x17fb
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %esi, %esi
movq %rcx, %rdi
cmpq %rdx, %rdi
je 0x17f9
movq %rsi, %r8
movq %rcx, %r9
cmpq %rdx, %r9
je 0x17ef
testq %r8, %r8
je 0x17e5
movl (%rdi), %r10d
subl (%r9), %r10d
movl %r10d, %r11d
negl %r11d
cmovsl %r10d, %r11d
cmpl %eax, %r11d
cmovll %r11d, %eax
addq $0x4, %r9
addq $-0x4, %r8
jmp 0x17c4
addq $0x4, %rdi
addq $0x4, %rsi
jmp 0x17b9
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x1080
movq 0x27b6(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x27c0(%rip), %rsi      # 0x3fd8
movq 0x27d1(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1140
nop
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::longestSpan()
int Span::longestSpan(void)
{
	int							max;
	int							tmp;
	std::vector<int>::iterator	it1;
	std::vector<int>::iterator	it2;

	if (this->list.size() <= 1)
		throw std::exception();
	max = 0;
	it1 = this->list.begin();
	while (it1 != this->list.end())
	{
		it2 = this->list.begin();
		while (it2 != this->list.end())
		{
			if (it1 != it2)
			{
				tmp = abs(*it1 - *it2);
				if (tmp > max)
					max = tmp;
			}
			it2++;
		}
		it1++;
	}
	return (max);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, %rax
subq %rcx, %rax
cmpq $0x5, %rax
jb 0x1888
xorl %esi, %esi
movq %rcx, %rdi
xorl %eax, %eax
cmpq %rdx, %rdi
je 0x1886
movq %rsi, %r8
movq %rcx, %r9
cmpq %rdx, %r9
je 0x187c
testq %r8, %r8
je 0x1872
movl (%rdi), %r10d
subl (%r9), %r10d
movl %r10d, %r11d
negl %r11d
cmovsl %r10d, %r11d
cmpl %eax, %r11d
cmovgl %r11d, %eax
addq $0x4, %r9
addq $-0x4, %r8
jmp 0x1851
addq $0x4, %rdi
addq $0x4, %rsi
jmp 0x1846
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x1080
movq 0x2729(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x2733(%rip), %rsi      # 0x3fd8
movq 0x2744(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1140
// File: /workspace/github_cpp_makefile_star2_O2/sc0ty[P]CODExtract/src/main.cpp
// Function: SaveIcon(CODFile*)
void SaveIcon(CODFile *cod)
{
    u16 size;
    char *data = cod->getIcon(size);

    // there is no icon in resources
    if (data == NULL)
    {
        cout << "\t  Icon file: <there is no icon>" << endl;
        return;
    }

    // generate icon file name
    string fn = cod->getFileName();
    size_t sz = fn.find_last_of('.');
    if (sz != string::npos) fn.resize(fn.find_last_of('.'));
    fn += "-icon.png";

    cout << "\t  Icon file: " << fn << endl;

    // open file to write
    ofstream of(fn.c_str(), ios::binary);
    if (!of.is_open()) throw "Cannot write to file";

    // write icon
    of.write(data, size);
    of.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %r14
leaq -0x1a(%rbp), %rsi
callq 0x357e
testq %rax, %rax
je 0x2b3a
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3210
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x2340
cmpq $-0x1, %rax
je 0x2aaa
leaq -0x40(%rbp), %r14
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x2340
movq %r14, %rdi
movq %rax, %rsi
callq 0x2270
leaq 0x1660(%rip), %rsi      # 0x4111
leaq -0x40(%rbp), %rdi
callq 0x2310
movq 0x3517(%rip), %rdi      # 0x5fd8
leaq 0x1653(%rip), %rsi      # 0x411b
callq 0x2190
leaq -0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20f0
movq -0x40(%rbp), %rsi
leaq -0x240(%rbp), %rdi
pushq $0x4
popq %rdx
callq 0x21e0
leaq -0x1d0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2b63
movzwl -0x1a(%rbp), %edx
leaq -0x240(%rbp), %rdi
movq %rbx, %rsi
callq 0x2250
leaq -0x240(%rbp), %rdi
callq 0x2280
leaq -0x240(%rbp), %rdi
callq 0x2290
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x2b55
movq 0x3497(%rip), %rdi      # 0x5fd8
leaq 0x15a8(%rip), %rsi      # 0x40f0
callq 0x2190
movq %rax, %rdi
callq 0x20f0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x15b8(%rip), %rcx      # 0x412a
movq %rcx, (%rax)
movq 0x344c(%rip), %rsi      # 0x5fc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x22e0
jmp 0x2b99
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x2290
jmp 0x2b9c
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/sc0ty[P]CODExtract/src/codfile/codfile.cpp
// Function: CODFile::CODFile()
CODFile::CODFile()
{
    HeadSeg = NULL;
    CodeSeg = NULL;
    DataSeg = NULL;
    FootSeg = NULL;
    isOpen = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x31c9(%rip), %rax      # 0x5d90
movq %rax, (%rdi)
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
xorl %eax, %eax
movb %al, 0x18(%rdi)
leaq 0x50(%rdi), %rcx
movq %rcx, 0x58(%rdi)
movq %rcx, 0x50(%rdi)
andq $0x0, 0x60(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x38(%rdi)
movb %al, 0x48(%rdi)
popq %rbp
retq
nop