// File: /workspace/github_cpp_makefile_star2_O2/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 $0x278, %rsp            # imm = 0x278
movl %r9d, -0x3c(%rbp)
leaq 0x6dd3(%rip), %rax      # 0xda68
movq %rax, (%rdi)
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movl %esi, -0x2c(%rbp)
leaq 0x8(%rdi), %rax
movq %rax, -0x38(%rbp)
movb $0x0, 0x18(%rdi)
cmpl $0x9c3, %r8d            # imm = 0x9C3
jg 0x6eff
movq %rdx, %rbx
cmpq $0x1e, 0x8(%rdx)
ja 0x6eff
movl %r8d, %r15d
movl %ecx, %r12d
movq %rdi, %r13
leaq -0xa0(%rbp), %rdi
movq %rbx, %rsi
callq 0x32f0
leaq -0xa0(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x3180
leaq -0xa0(%rbp), %rdi
callq 0x3130
movq %r13, %rdi
callq 0x6fb2
leaq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x32f0
leaq 0x2a0a(%rip), %rsi      # 0x9729
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x678e
leaq 0x28d5(%rip), %rdx      # 0x9608
leaq -0x2a0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x58b3
leaq -0x2a0(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32c0
movq %r14, %rdi
callq 0x3130
leaq -0x60(%rbp), %rdi
callq 0x3130
leaq -0x80(%rbp), %rdi
callq 0x3130
leaq -0x2a0(%rbp), %rdi
callq 0x33c0
leaq -0x2a0(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x3140
movq 0x7214(%rip), %rsi      # 0xdfa8
pushq $0x30
popq %rdi
callq 0x3470
testq %rax, %rax
je 0x6db2
movq %rax, %rbx
movq %rax, %rdi
callq 0x6098
movq %rbx, 0x40(%r13)
jmp 0x6dd2
andq $0x0, 0x40(%r13)
movq 0x7202(%rip), %rdi      # 0xdfc0
leaq 0x266e(%rip), %rsi      # 0x9433
callq 0x3270
movq %rax, %rdi
callq 0x3150
movl -0x2c(%rbp), %ecx
cmpl $0x3, %ecx
pushq $0x3
popq %rax
cmovbl %ecx, %eax
movl %eax, 0x28(%r13)
xorpd %xmm0, %xmm0
testl %r15d, %r15d
js 0x6dfc
cvtsi2sd %r15d, %xmm1
movsd 0x2808(%rip), %xmm0     # 0x9600
minsd %xmm1, %xmm0
movsd %xmm0, 0x30(%r13)
movb %r12b, 0x3a(%r13)
andw $0x0, 0x38(%r13)
leaq 0x2802(%rip), %rsi      # 0x9615
leaq -0x2a0(%rbp), %rdi
callq 0x3270
leaq -0x2a0(%rbp), %rdi
callq 0x3150
movzbl 0x3a(%r13), %esi
movq %rax, %rdi
callq 0x33a0
leaq 0x2976(%rip), %rsi      # 0x97b5
movq %rax, %rdi
callq 0x3270
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x70ca
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x3260
leaq 0x294c(%rip), %rsi      # 0x97b5
movq %rax, %rdi
callq 0x3270
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x33e0
leaq 0x2932(%rip), %rsi      # 0x97b5
movq %rax, %rdi
callq 0x3270
movq %rax, %rdi
movl %r15d, %esi
callq 0x33e0
leaq 0x2918(%rip), %rsi      # 0x97b5
movq %rax, %rdi
callq 0x3270
movzbl -0x3c(%rbp), %esi
movq %rax, %rdi
callq 0x33a0
leaq 0x28fd(%rip), %rsi      # 0x97b5
movq %rax, %rdi
callq 0x3270
movzbl 0x10(%rbp), %esi
movq %rax, %rdi
callq 0x33a0
leaq -0x60(%rbp), %rdi
callq 0x3130
leaq -0x2a0(%rbp), %rdi
callq 0x3300
leaq -0x2a0(%rbp), %rdi
callq 0x3320
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x3160
movq %rax, %r14
leaq 0x2724(%rip), %rsi      # 0x9635
movq %rax, %rdi
callq 0x3440
movq 0x70b8(%rip), %rsi      # 0xdfd8
movq 0x70a1(%rip), %rdx      # 0xdfc8
movq %r14, %rdi
callq 0x33d0
movq %rax, %r15
movq %r14, %rdi
callq 0x31e0
jmp 0x6fa0
movq %rax, %r15
movq 0x7062(%rip), %rsi      # 0xdfa8
movq %rbx, %rdi
callq 0x3190
jmp 0x6f94
jmp 0x6f83
jmp 0x6f7e
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x3130
jmp 0x6f65
movq %rax, %r15
leaq -0x80(%rbp), %rdi
jmp 0x6f77
jmp 0x6f7e
movq %rax, %r15
leaq -0xa0(%rbp), %rdi
callq 0x3130
jmp 0x6fa0
movq %rax, %r15
jmp 0x6fa0
movq %rax, %r15
jmp 0x6f94
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x3130
leaq -0x2a0(%rbp), %rdi
callq 0x3320
movq -0x38(%rbp), %rdi
callq 0x3130
movq %r15, %rdi
callq 0x33f0
nop