// File: /workspace/github_cpp_makefile_star2_O3/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 %ecx, -0x58(%rbp)
movl %esi, -0x2c(%rbp)
leaq 0x7de7(%rip), %rax      # 0xfa58
movq %rax, (%rdi)
leaq 0x8(%rdi), %rax
movq %rax, -0x70(%rbp)
leaq 0x18(%rdi), %rax
movq %rax, -0x68(%rbp)
movq %rax, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movb $0x0, 0x18(%rdi)
cmpl $0x9c3, %r8d            # imm = 0x9C3
jg 0x80a7
movq %rdx, %r14
movq 0x8(%rdx), %rdx
cmpq $0x1e, %rdx
ja 0x80a7
movl %r9d, %ebx
movl %r8d, %r15d
movq %rdi, %r13
leaq -0xa0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
addq %rsi, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x6930
leaq -0xb0(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x3160
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x7d04
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x3290
movq %r13, %rdi
callq 0x81ac
movl %r15d, -0x5c(%rbp)
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x6930
leaq 0x3a43(%rip), %rcx      # 0xb779
leaq -0x90(%rbp), %rdi
movl $0x6, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x32b0
leaq -0x40(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7d70
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x7d78
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38be(%rip), %rsi      # 0xb658
callq 0x3470
leaq -0x2a0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movl %ebx, -0x54(%rbp)
je 0x7dd0
movq %rdx, -0x2b0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x2a0(%rbp)
jmp 0x7dda
movupd (%rcx), %xmm0
movupd %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x2b0(%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 0x7e1a
movq -0x2a0(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7e33
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x7e4b
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x3290
leaq -0x2b0(%rbp), %rdi
callq 0x33f0
movl -0x5c(%rbp), %r15d
leaq -0x2b0(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3120
movq 0x8122(%rip), %rsi      # 0xff98
movl $0x30, %edi
callq 0x3480
testq %rax, %rax
je 0x7e9a
movq %rax, %r14
movq %rax, %rdi
callq 0x6f74
leaq 0x40(%r13), %r12
movq %r14, 0x40(%r13)
jmp 0x7eec
movq $0x0, 0x40(%r13)
movq 0x8117(%rip), %r14      # 0xffc0
leaq 0x3583(%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 0x80e5(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
leaq 0x40(%r13), %r12
movl -0x2c(%rbp), %ecx
cmpl $0x3, %ecx
movl $0x3, %eax
cmovbl %ecx, %eax
movl %eax, 0x28(%r13)
xorpd %xmm0, %xmm0
testl %r15d, %r15d
js 0x7f18
cvtsi2sd %r15d, %xmm1
movsd 0x373c(%rip), %xmm0     # 0xb650
minsd %xmm1, %xmm0
movsd %xmm0, 0x30(%r13)
movl -0x58(%rbp), %eax
movb %al, 0x3a(%r13)
movw $0x0, 0x38(%r13)
leaq 0x3732(%rip), %rsi      # 0xb665
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x32d0
movq -0x2b0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
leaq -0x2b0(%rbp), %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movzbl 0x3a(%r13), %esi
movq %rax, %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x387f(%rip), %rsi      # 0xb805
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq (%r12), %rsi
leaq -0x50(%rbp), %rdi
callq 0x71a2
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x32d0
movq %rax, %rbx
leaq 0x384b(%rip), %rsi      # 0xb805
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
callq 0x3410
movq %rax, %rbx
leaq 0x3829(%rip), %rsi      # 0xb805
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3410
movq %rax, %rbx
leaq 0x3807(%rip), %rsi      # 0xb805
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movzbl -0x54(%rbp), %esi
movq %rbx, %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x37e4(%rip), %rsi      # 0xb805
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movzbl 0x10(%rbp), %esi
movq %rbx, %rdi
callq 0x33d0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x8053
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3290
leaq -0x2b0(%rbp), %rdi
callq 0x3310
movq 0x7f52(%rip), %rax      # 0xffb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2a8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2b0(%rbp,%rcx)
callq 0x3210
leaq -0x1b8(%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 0x35ca(%rip), %rsi      # 0xb685
movq %rax, %rdi
callq 0x3460
movq 0x7f0e(%rip), %rsi      # 0xffd8
movq 0x7ef7(%rip), %rdx      # 0xffc8
movq %r14, %rdi
callq 0x3400
movq %rax, %rbx
movq %r14, %rdi
callq 0x31d0
jmp 0x8188
movq %rax, %rbx
movq 0x7ea5(%rip), %rsi      # 0xff98
movq %r14, %rdi
callq 0x3170
jmp 0x817c
jmp 0x8179
jmp 0x8156
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x8122
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x8122
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x8188
movq -0x80(%rbp), %rsi
jmp 0x814c
jmp 0x8156
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x8188
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x8188
movq %rax, %rbx
jmp 0x8188
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x817c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x817c
movq %rax, %rbx
leaq -0x2b0(%rbp), %rdi
callq 0x3330
movq -0x70(%rbp), %rax
movq (%rax), %rdi
cmpq -0x68(%rbp), %rdi
je 0x81a4
movq -0x68(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3420