// File: 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
subq $0x390, %rsp            # imm = 0x390
movl %r9d, -0x308(%rbp)
movl %ecx, %eax
movl -0x308(%rbp), %ecx
movq %rdx, -0x2f0(%rbp)
movl %esi, %edx
movq -0x2f0(%rbp), %rsi
movl %edx, -0x304(%rbp)
movq %rdi, %r9
movl -0x304(%rbp), %edi
movb %al, %dl
movb 0x10(%rbp), %al
movq %r9, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %dl
movb %dl, -0x19(%rbp)
movl %r8d, -0x20(%rbp)
andb $0x1, %cl
movb %cl, -0x21(%rbp)
andb $0x1, %al
movb %al, -0x22(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x300(%rbp)
leaq 0xc8b0(%rip), %rax      # 0x1ba50
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x4420
movq -0x2f0(%rbp), %rdi
callq 0x4460
cmpq $0x1f, %rax
jae 0xf626
cmpl $0x9c4, -0x20(%rbp)     # imm = 0x9C4
jge 0xf626
movq -0x2f0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x4150
jmp 0xf1ec
movq -0x300(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xf060
jmp 0xf1fe
leaq -0x48(%rbp), %rdi
callq 0x4200
movq -0x300(%rbp), %rdi
callq 0xf6a0
jmp 0xf215
movq -0x300(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0xf0c0
jmp 0xf22a
leaq 0x4500(%rip), %rsi      # 0x13731
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0xd000
jmp 0xf246
leaq 0x43c3(%rip), %rdx      # 0x13610
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x8920
jmp 0xf25f
movq -0x2f0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %rsi, -0x310(%rbp)
callq 0x43b0
movq -0x310(%rbp), %rdi
callq 0x4200
leaq -0x98(%rbp), %rdi
callq 0x4200
leaq -0xb8(%rbp), %rdi
callq 0x4200
leaq -0x2b8(%rbp), %rdi
callq 0x44e0
jmp 0xf2a8
movq -0x2f0(%rbp), %rsi
leaq -0x2b8(%rbp), %rdi
movl $0x10, %edx
callq 0x4190
jmp 0xf2c2
movl $0x30, %edi
movq 0xccd2(%rip), %rsi      # 0x1bfa0
callq 0x45f0
movq %rax, %rcx
movq %rcx, -0x320(%rbp)
movb $0x0, -0x2c1(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movq %rax, -0x318(%rbp)
je 0xf31f
movq -0x320(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
movb $0x1, -0x2c1(%rbp)
callq 0xbce0
jmp 0xf30f
movq -0x320(%rbp), %rax
movq %rax, -0x318(%rbp)
jmp 0xf31f
movq -0x300(%rbp), %rcx
movq -0x318(%rbp), %rax
movq %rax, 0x40(%rcx)
xorl %eax, %eax
cmpq 0x40(%rcx), %rax
jne 0xf415
movq 0xcc7c(%rip), %rdi      # 0x1bfc0
leaq 0x40e8(%rip), %rsi      # 0x13433
callq 0x4310
movq %rax, -0x328(%rbp)
jmp 0xf359
movq -0x328(%rbp), %rdi
movq 0xcc49(%rip), %rsi      # 0x1bfb0
callq 0x4340
jmp 0xf36e
jmp 0xf415
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xf68a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4200
jmp 0xf68a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xf3c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4200
leaq -0xb8(%rbp), %rdi
callq 0x4200
jmp 0xf68a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xf618
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
testb $0x1, -0x2c1(%rbp)
jne 0xf3fd
jmp 0xf410
movq -0x2c0(%rbp), %rdi
movq 0xcb95(%rip), %rsi      # 0x1bfa0
callq 0x41e0
jmp 0xf618
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xf830
jmp 0xf426
movq -0x300(%rbp), %rdi
cvtsi2sdl -0x20(%rbp), %xmm0
callq 0xf8a0
jmp 0xf439
movq -0x300(%rbp), %rax
movb -0x19(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x3a(%rax)
movb $0x0, 0x38(%rax)
movb $0x0, 0x39(%rax)
leaq 0x41c5(%rip), %rsi      # 0x1361d
leaq -0x2b8(%rbp), %rdi
callq 0x4310
jmp 0xf466
movq 0xcb43(%rip), %rsi      # 0x1bfb0
leaq -0x2b8(%rbp), %rdi
callq 0x4340
movq %rax, -0x330(%rbp)
jmp 0xf482
movq -0x300(%rbp), %rdi
callq 0x8900
movb %al, -0x331(%rbp)
jmp 0xf496
movq -0x330(%rbp), %rdi
movb -0x331(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x4540
movq %rax, -0x340(%rbp)
jmp 0xf4b7
movq -0x340(%rbp), %rdi
leaq 0x42e8(%rip), %rsi      # 0x137ad
callq 0x4310
movq %rax, -0x348(%rbp)
jmp 0xf4d3
movq -0x300(%rbp), %rsi
leaq -0x2e8(%rbp), %rdi
callq 0xf910
jmp 0xf4e8
movq -0x348(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x42f0
movq %rax, -0x350(%rbp)
jmp 0xf504
movq -0x350(%rbp), %rdi
leaq 0x429b(%rip), %rsi      # 0x137ad
callq 0x4310
movq %rax, -0x358(%rbp)
jmp 0xf520
movq -0x358(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4510
movq %rax, -0x360(%rbp)
jmp 0xf538
movq -0x360(%rbp), %rdi
leaq 0x4267(%rip), %rsi      # 0x137ad
callq 0x4310
movq %rax, -0x368(%rbp)
jmp 0xf554
movq -0x368(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x4510
movq %rax, -0x370(%rbp)
jmp 0xf56c
movq -0x370(%rbp), %rdi
leaq 0x4233(%rip), %rsi      # 0x137ad
callq 0x4310
movq %rax, -0x378(%rbp)
jmp 0xf588
movq -0x378(%rbp), %rdi
movzbl -0x21(%rbp), %esi
andl $0x1, %esi
callq 0x4540
movq %rax, -0x380(%rbp)
jmp 0xf5a4
movq -0x380(%rbp), %rdi
leaq 0x41fb(%rip), %rsi      # 0x137ad
callq 0x4310
movq %rax, -0x388(%rbp)
jmp 0xf5c0
movq -0x388(%rbp), %rdi
movzbl -0x22(%rbp), %esi
andl $0x1, %esi
callq 0x4540
jmp 0xf5d5
leaq -0x2e8(%rbp), %rdi
callq 0x4200
leaq -0x2b8(%rbp), %rdi
callq 0x4430
jmp 0xf5ef
leaq -0x2b8(%rbp), %rdi
callq 0x4450
jmp 0xf681
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4200
leaq -0x2b8(%rbp), %rdi
callq 0x4450
jmp 0xf68a
movl $0x10, %edi
callq 0x41a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x390(%rbp)
leaq 0x3ff9(%rip), %rsi      # 0x1363d
callq 0x4590
jmp 0xf64b
movq -0x390(%rbp), %rdi
movq 0xc97f(%rip), %rsi      # 0x1bfd8
movq 0xc968(%rip), %rdx      # 0x1bfc8
callq 0x44f0
jmp 0xf69f
movq -0x390(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x4250
jmp 0xf68a
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
movq -0x2f8(%rbp), %rdi
callq 0x4200
movq -0x50(%rbp), %rdi
callq 0x4520
nop