// File: /workspace/github_cpp_makefile_star2_O1/Serfati[P]Heroes-of-Might-and-Magic-3/Hero.cpp
// Function: Hero::Hero(Type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, int, bool, bool)
Hero::Hero(Type type,string name,bool live,int gold,bool gotDG,bool usedSA) {
    if ( name.length() < 31 && gold < 2500) {
        setName(name);
        mkdir();
        name = "Heros/" + getName() + "/Details.txt";
        ofstream file;
        file.open(name);
        this->army = new(nothrow) Army();
        if ( nullptr == this->army ) cout << "Error: memory could not be allocated" << endl;
        setType(type);
        setGold(gold);
        this->isAlive = live;
        this->gotDG = false;
        this->usedSA = false;

        //SAVE
        file << "live|B:W:A:V:Z|type|gold|DG|SA;";
        file << endl << inLife() << " " << showArmy() << " " << type << " " << gold << " " << gotDG << " " << usedSA;
        file.close();
    }
    else
        throw std::invalid_argument("received invalid user arguments! try again.");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movl %r9d, -0x4c(%rbp)
movl %ecx, -0x50(%rbp)
movl %esi, -0x54(%rbp)
leaq 0x7dbf(%rip), %rax      # 0xfa58
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
leaq 0x18(%rdi), %rax
movq %rax, -0x60(%rbp)
movq %rax, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movb $0x0, 0x18(%rdi)
movl %r8d, -0x58(%rbp)
cmpl $0x9c3, %r8d            # imm = 0x9C3
movq %r12, -0x68(%rbp)
jg 0x80bf
movq %rdx, %r14
movq 0x8(%rdx), %rdx
cmpq $0x1e, %rdx
ja 0x80bf
movq %rdi, %r13
leaq -0x98(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%r14), %rsi
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x693a
leaq -0xa8(%rbp), %rsi
movq %r12, %rdi
callq 0x3160
movq -0xa8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7d28
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3290
movq %r13, %rdi
callq 0x81d0
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x693a
leaq 0x3a43(%rip), %rcx      # 0xb799
leaq -0x88(%rbp), %rdi
movl $0x6, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x32b0
leaq -0x38(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7d90
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x7d98
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq -0x48(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38be(%rip), %rsi      # 0xb678
callq 0x3470
leaq -0x298(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7ded
movq %rdx, -0x2a8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x298(%rbp)
jmp 0x7df7
movupd (%rcx), %xmm0
movupd %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x2a8(%rbp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32f0
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x7e37
movq -0x298(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
movl -0x54(%rbp), %r12d
je 0x7e54
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
movl -0x58(%rbp), %r15d
je 0x7e70
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3290
leaq -0x2a8(%rbp), %rdi
callq 0x33f0
leaq -0x2a8(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3120
movq 0x8101(%rip), %rsi      # 0xff98
movl $0x30, %edi
callq 0x3480
testq %rax, %rax
je 0x7eb3
movq %rax, %r14
movq %rax, %rdi
callq 0x6fa4
jmp 0x7eb6
xorl %r14d, %r14d
movq %r14, 0x40(%r13)
testq %r14, %r14
jne 0x7f05
movq 0x80fa(%rip), %r14      # 0xffc0
leaq 0x3566(%rip), %rsi      # 0xb433
movl $0x24, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0x80c8(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
cmpl $0x3, %r12d
movl $0x3, %eax
cmovbl %r12d, %eax
movl %eax, 0x28(%r13)
xorpd %xmm0, %xmm0
testl %r15d, %r15d
js 0x7f30
cvtsi2sd %r15d, %xmm1
movsd 0x3744(%rip), %xmm0     # 0xb670
minsd %xmm1, %xmm0
movsd %xmm0, 0x30(%r13)
movl -0x50(%rbp), %eax
movb %al, 0x3a(%r13)
movw $0x0, 0x38(%r13)
leaq 0x373a(%rip), %rsi      # 0xb685
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x32d0
movq -0x2a8(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
leaq -0x2a8(%rbp), %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movzbl 0x3a(%r13), %esi
movq %rax, %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x3887(%rip), %rsi      # 0xb825
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq 0x40(%r13), %rsi
leaq -0x48(%rbp), %rdi
callq 0x71e4
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x32d0
movq %rax, %rbx
leaq 0x3853(%rip), %rsi      # 0xb825
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3410
movq %rax, %rbx
leaq 0x3831(%rip), %rsi      # 0xb825
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3410
movq %rax, %rbx
leaq 0x380f(%rip), %rsi      # 0xb825
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movzbl -0x4c(%rbp), %esi
movq %rbx, %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x37ec(%rip), %rsi      # 0xb825
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movzbl 0x10(%rbp), %esi
movq %rbx, %rdi
callq 0x33d0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x806b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
leaq -0x2a8(%rbp), %rdi
callq 0x3310
movq 0x7f3a(%rip), %rax      # 0xffb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2a0(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2a8(%rbp,%rcx)
callq 0x3210
leaq -0x1b0(%rbp), %rdi
callq 0x30d0
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3140
movq %rax, %r14
leaq 0x35d2(%rip), %rsi      # 0xb6a5
movq %rax, %rdi
callq 0x3460
movq 0x7ef6(%rip), %rsi      # 0xffd8
movq 0x7edf(%rip), %rdx      # 0xffc8
movq %r14, %rdi
callq 0x3400
movq %rax, %r15
movq %r14, %rdi
callq 0x31d0
jmp 0x81ac
movq %rax, %r15
movq 0x7e8d(%rip), %rsi      # 0xff98
movq %r14, %rdi
callq 0x3170
jmp 0x81a0
jmp 0x819d
jmp 0x817a
movq %r15, %rbx
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x8146
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x8146
movq %r15, %rbx
movq %rax, %r15
movq -0x88(%rbp), %rdi
cmpq %rbx, %rdi
je 0x81ac
movq -0x78(%rbp), %rsi
jmp 0x8170
jmp 0x817a
movq %rax, %r15
movq -0xa8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x81ac
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x81ac
movq %rax, %r15
jmp 0x81ac
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x81a0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x81a0
movq %rax, %r15
leaq -0x2a8(%rbp), %rdi
callq 0x3330
movq -0x68(%rbp), %rax
movq (%rax), %rdi
cmpq -0x60(%rbp), %rdi
je 0x81c8
movq -0x60(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3290
movq %r15, %rdi
callq 0x3420